Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No default export found in module is unclear #751

Closed
joshkalpin opened this issue Feb 23, 2017 · 2 comments · Fixed by #1470
Closed

Error: No default export found in module is unclear #751

joshkalpin opened this issue Feb 23, 2017 · 2 comments · Fixed by #1470

Comments

@joshkalpin
Copy link

I recently encountered an an issue in my code where I was getting this error: No default export found in module. This message to me indicated that I was missing a export default within the file I was modifying. However, it instead was related to an import I had. I think this message should be a bit more clear in specifying that an import is incorrect.

Bad Version: import blah from 'blah'
Fixed Version: import * as blah from 'blah'

Sorry if this is duplicated or described badly, but it was super super confusing.

@atav32
Copy link

atav32 commented Dec 8, 2017

But did you have a default export specified?

@verdverm
Copy link

I think I just ran into this.

import { moo } from './moo'

export const foo = (args) => {
  console.log(args)
  moo.say(args)
}

export default foo;
import moo from './moo';

export const goo = args => {
  console.log(args)
  moo.say(args)
}

export default goo;

The second one was wrong and I got the same error message. A third file that imported the erroneous file also complained about exports too. That may or may not have been related to my switching the import style in that file and changing the erroneous file export style to fix the confusing message.

Seeing this issue defiinitely helped me find my own issue right away. The message could be clearer about the line and failing import name which has no default (Moo in this case was being imported incorrectly, but it seemed like it was Goo that had the issue)

Something like imported file "blah" in Goo has no default export. did you mean? import { ... } from '<insert-file-name>

ljharb pushed a commit to golopot/eslint-plugin-import that referenced this issue Sep 4, 2019
@ljharb ljharb closed this as completed in 726dda5 Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants