How to avoid relative paths in Javascript import autocompletion?

Hi guys,

how can we change the javascript import autocompletion on IntelliJ to use the "sources root" folder instead of relative paths?

This is related to the NODE_PATH=src.

 

For example,

How can we achieve this:

import {MyClass} from 'components/administration/dashboard'

instead of this:

import {MyClass} from "../../dashboard";

 

3 comments
Comment actions Permalink

Please try marking `src` as Resource root (Mark directory as/Resource Root) and enabling Use paths relative to project, resource or sources roots in Settings | Editor | Code Style | JavaScript | Imports - does it help?

12
Comment actions Permalink

Hi, I'd prefer import from relative path when file to import is in the same folder, but auto import always use absolute path base on tsconfig, which will resolve a longer path than relative path. I'm using webstorm 2018.1.3

0
Comment actions Permalink

Please vote for https://youtrack.jetbrains.com/issue/WEB-31972 to be notified on any progress with it

0

Please sign in to leave a comment.