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";

 

5
3 comments

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?

16
Avatar
Permanently deleted user

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

1

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.