IntelliJ IDEA mistakenly requires .js suffix on ES6 module import.

I am using the latest version of IntelliJ IDEA. I have enabled Javascript ES6 support. 

The IDE mistakenly forces me to include the .js suffix for all module imports. Is there some setting that I can change to fix this. Note I am using webpack and the IDE is telling me that webpack.config is providing module resolution rules. Is this the issue? If so how do I resolve it?

 

8 comments

Do you have Use file extension in module name enabled in Settings | Editor | Code Style | JavaScript?

0

Can you provide the detailed problem description then?

0

Very strange. I now no longer get the error complaining about the missing suffix. Very weird. I did upgrade versions yesterday. Anyway. Thanks for the assist.

 

0

Should the problem occur again, please provide a screenshot of the error message

0

Ok, the problem is indeed back but only for a particular project. One project - a mid-size web app with maybe 2 dozen modules - this is not an issue. Suffix are not required. However for a smaller project - same IDE settings - it is always an issue.

 

Here is the project settings:

 

Here are the module imports

Here is the error

I just don't get it.

 

 

0

Hmm.. these are runtime errors shown in browser that don't seem to be related to IDEA.

Do you use browser's native support for ES6 modules (via <script type="module">)? Chrome requires specifying .js extension explicitly - see comments in https://medium.com/dev-channel/es6-modules-in-chrome-canary-m60-ba588dfb8ab7

0

Ahhh. Right. It's a Chrome thing. Ok. Thanks a lot.

 

0

Please sign in to leave a comment.