TypeScript: Rush's node_modules structure is not resolved in vscode correctly
- VSCode Version: 1.28.2 (or insiders)
- OS Version: Arch linux
When trying to auto-import node modules within a rush project, intellisense will not locate dependencies. This also results in the editor crashing or re-initializing the TS server somewhat often.
This is likely due to rush’s unique node module structure, and it’s unclear if this ever worked as I have only adopted rush somewhat recently.
Steps to Reproduce:
You can replicate this issue within the web-build-tools repo itself.
- Open https://github.com/Microsoft/web-build-tools/blob/master/libraries/ts-command-line/src/index.ts
- type
Colorsin the top level (from the colors module). You shouldn’t be able to resolve the symbol.
eg.
const foo: Colors = {};
export {
CommandLineAction,
ICommandLineActionOptions
} from './CommandLineAction';
This also seems to correlate with the editor’s TS server crashing intermittently, but its not clear how to reproduce.
Does this issue occur when all extensions are disabled?: Yes
Versions tested:
- rush v5.5.2 / v5.3.0
- node 6 / node 10
- vscode v1.28.2 / insiders
- with either of: npm, yarn or pnpm (all latest)
- has been tested on multiple linux systems
Workaround
If you execute the below script to replace symlinks with real files:
mv node_modules node_modules_old
rsync node_modules_old/ node_modules/ -a --copy-links -v
Everything should work as expected.
There seems to be an issue with symlinks.
Related: https://github.com/Microsoft/web-build-tools/issues/955
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 35 (11 by maintainers)
Commits related to this issue
- When the imported module is through node_modules and symlink to folder that isnt node_modules Most of the monorepo like scenarios are like this so looking at symlink to decide if file can be imported ... — committed to microsoft/TypeScript by sheetalkamat 4 years ago
- When the imported module is through node_modules and symlink to folder that isnt node_modules (#37387) * Add tests that fail because of symlink to non common directory node_modules * When the imp... — committed to microsoft/TypeScript by sheetalkamat 4 years ago
still have this problem…
@RDeluxe Thank you for repro. we will investigate this.
Hello @sheetalkamat ! Thanks for your time.
To be thorough I updated my repo https://github.com/RDeluxe/rush-repro-955
The README should explain everything. There are 3 projects there:
Good news… i have fix prototype available… need to polish it and write some tests… But i will get PR up soon.