WebStorm always chooses the wrong auto import path in a workspace
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
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

... 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 🤔
... does this option exist for vscode too? only found
Typescript->Prefs->Import Module Specifierbut this does not allow me to set an equivalent option 🤔
@skydever Did you have any luck figuring out this?
I'm facing an issue with nx and next: when I use VS Code auto-import from the next app, it will use an absolute import which immediately triggers the @nrwl/nx/enforce-module-boundaries eslint rule.
For example, with folder structure:
pages/
entity/
new/
index.tsx
components/
Loading.tsx
The generated import will be:
// in pages/entity/new/index.tsx
import Loading from 'apps/panel/components/Loading'
The possible settings are to always use relative paths, but that will prevent me from importing libraries in the proper way :(
... sadly not, I use the lightbulb to import, it usually has the correct option available :/
In case someone wants to set the setting described by @brampeirs in the .editorconfig-file, you need to use the following:
[*.ts]
ij_typescript_use_path_mapping = different_paths
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.