JavaScript / ES2015 Import does not find file

Hello,

I keep running into the following problem:

I am using the import feature of ES2015. If I have 2 files in different directories that have the same name, like this

/src/form.js

/src/events/form.js

and from the events folder I import the form.js file like this

import TypeEvent from './form';

I get the error

Default export is not declared in imported module

The problem is not that I do not have a default export—it is there, my code works and there is no problem with it—the problem is that I have 2 files that have the same name and the other one does not have a default export. But I am not trying to import the other one. WebStorm seems to be confused which file I am trying to import. When I cmd+click on the imported filename, WebStorm opens a context menu, asking me which file I want to navigate to.

Is there a way to get rid of the error? Like writing the import differently or setting something up in WebStorm?

Thank you,
Lukas

1 comment
Comment actions Permalink

works fine for me using similar setup - no errors are reported, navigation works as expected;
Please try the attached project - does import in src/events/main.js work for you? If yes, please try modifying it to match you setup and recreate the issue



Attachment(s):
untitled2.zip
0

Please sign in to leave a comment.