PHPStorm not adding ".js" on module names

The autocompletion in PhpStorm is generally pretty nice, but I keep getting caught out by it adding import statements without the ".js" on the end. E.g...

import {OPTIONS} from './app';

Then when I go to run my code I get errors like this one...

GET https://mydomain.com/script/app   net::ERR_ABORTED   404 (Not Found)

I always have to go in and manually fix the code, like this...

import {OPTIONS} from './app.js';

It's frustrating that it does that and I'm wondering if I'm missing something. It's even more annoying when adding a new import from the same module as it creates a whole new line and I then have to merge the two together.

Any thoughts?

 

0

Please try enabling Use file extension in module name in Settings | Editor | Code Style | JavaScript | Imports

0

请先登录再写评论。