Nx: WebStorm always chooses the wrong auto import path in a workspace

Created on 2 Nov 2017  Â·  4Comments  Â·  Source: nrwl/nx

Loving nx <3

This is probably not in your control at all, but any time WebStorm auto-imports something, it chooses the @project-name/lib absolute format, even with the symbol you are importing is in the same directory of the file you are currently working on. Ideally that format would only be used if you are in a different lib / app.

This is sort of at the "annoyance" level, but its the worst one for me after a few days of using workspaces, so figured I would report.

seeing this on

WebStorm 2017.2.5
Build #WS-172.4343.25, built on October 20, 2017
JRE: 1.8.0_152-release-915-b12 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

Most helpful comment

Go to Settings/Preferences dialog (⌘,) -> Code Style -> Editor -> choose JavaScript or TypeScript -> imports tab -> select only in files outside specified paths
Screen Shot 2019-05-13 at 10 51 18

All 4 comments

I noticed that this stopped working with the new patch of 2017.2.5. I wonder if it's just a setting in the typescript of webstorm.

@mbriggs I agree, that drives me nuts too. :) But I don't think there is anything we can do on the Nx side of things in the tsconfig file to help WebStorm be aware of those scenarios. We have several WebStorm users though, so if a solution arises in the future I am sure we will work it in!

Go to Settings/Preferences dialog (⌘,) -> Code Style -> Editor -> choose JavaScript or TypeScript -> imports tab -> select only in files outside specified paths
Screen Shot 2019-05-13 at 10 51 18

... does this option exist for vscode too? only found Typescript->Prefs->Import Module Specifier but this does not allow me to set an equivalent option 🤔

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IonFoXx picture IonFoXx  Â·  3Comments

vimalraj-a picture vimalraj-a  Â·  3Comments

jon301 picture jon301  Â·  3Comments

elliotmendiola picture elliotmendiola  Â·  3Comments

dereklin picture dereklin  Â·  3Comments