Mintendo
Mintendo

Reputation: 567

PhpStorm - Autocomplete JS modules from Resource Root

I'm using PhpStorm as IDE and I want to import my JS modules from my Resource Root with @ prefix. I've already marked src directory as 'Resource Root' and I've also checked the "Use path relative to the project" in File/Settings/Code Style/Javascript/Imports.

In fact, the modules are imported correctly if I do for example: @/components/HelloWorld.vue, but I noticed that in this way I lost the autocompletion and the possibility to navigate through the files with Ctrl + MOUSE CLICK.

So is there a way to resolve this and to enable the autocomplete of path?

enter image description here

Upvotes: 0

Views: 227

Answers (1)

lena
lena

Reputation: 93868

Marking a folder as Resource root tells the IDE to resolve paths relative to this folder, but doesn't allow specifying any prefixes/aliases. If your are using Vue cli 3, the right way to get your paths resolved is specifying node_modules\@vue\cli-service\webpack.config.js as webpack configuration file in Settings | Languages & Frameworks | JavaScript | Webpack

enter image description here

Upvotes: 2

Related Questions