Issue with '../..' import

In Webstrom 2020.2.3 I am having an issue with suggested imports. Whenever I begin typing a module name, Webstorm auto-suggests using an import in the following format:

import { MyModule } from '../..'

It seems that a traditional import such as the following is not being suggested.

import { MyModule } from '../modules/MyModule.tsx'

Is there any way I can configure Webstorm to use the full relative path import rather than the shortened import? I tried changing some of the settings in Editor | Code Style | Javascript | Imports but I couldn't find a way to turn this off. 

0
2 comments

Could you share a sample project the issue can be repeated with?

0
Avatar
Permanently deleted user

I'm having some issues reproducing it in a simple project. More specifically the issue occurred when I had a barrel file (file filled with export * from 'myModule). I was able to solve this by marking my barrel file as plain text. I guess WebStorm saw the barrel file exporting everything, and tried to use this syntax as a shortcut.

This issue with the '../..' syntax is that my imports were evaluating to undefined at runtime. I'm not sure why. Using the explicit import solved this. 

I will continue to try and reproduce this in a simple project, but I guess we can consider this closed until I can reproduce. 

0

Please sign in to leave a comment.