Skip to content

If node_modules folder or a subfolder (like with pnpm) is a symlink (under Windows), TypeScript auto imports do not work anymore #36104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stefanocke opened this issue Jan 9, 2020 · 7 comments
Assignees
Labels
Domain: Auto-import Fixed A PR has been merged for this issue

Comments

@stefanocke
Copy link

  • VSCode Version: 1.41.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. Copy some TypeScript project into a new folder
  2. There, replace node_modules directory by a symlink to the node_modules in the original TypeScript project
  3. Try to import something from node_modules in the copied project (for example, somethinf from @angular/core in an Angular project). The import will work (no compiler error), but there is no light bulb and no intellisense support for the import

More explanation:

  • We use symlinked node_modules to share them between multiple projects. It is our own solution, but tools like https://pnpm.js.org/ do similar things. So, other users might have the same issue.
  • I have not tested it under Linux yet. Only Win 10.
  • I have searched for similar issues with keyword "symlink", but I am not sure any of them matches.
  • I think it stopped working some months ago but unfortunately I cannot tell exactly. I am sure it worked in the past.

Does this issue occur when all extensions are disabled?: Yes

@vscodebot vscodebot bot assigned mjbvz Jan 9, 2020
@microsoft microsoft deleted a comment from vscodebot bot Jan 9, 2020
@mjbvz mjbvz transferred this issue from microsoft/vscode Jan 9, 2020
@mjbvz
Copy link
Contributor

mjbvz commented Jan 9, 2020

Can you please try upgrading your workspace to use typescript@next by installing this extension. Does that fix the issue?

@stefanocke
Copy link
Author

@mjbvz , with typescript@next (3.8.0-dev.20200109), there is no difference.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jan 10, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jan 10, 2020
@stefanocke stefanocke changed the title If node_modules folder is a symlink (under Windows), TypeScript auto imports do not work anymore If node_modules folder or a subfolder (like with pnpm) is a symlink (under Windows), TypeScript auto imports do not work anymore Jan 25, 2020
@stefanocke
Copy link
Author

I verified with pnmp.
There, not node_module itself is a symlink, but the subfolders are.
Same effect: Auto-import is not working.

@thynson
Copy link

thynson commented Mar 23, 2020

Auto import does not work in macOS with pnpm, too.

@sheetalkamat sheetalkamat added Needs More Info The issue still hasn't been fully clarified and removed Bug A bug in TypeScript labels Mar 23, 2020
@sheetalkamat
Copy link
Member

sheetalkamat commented Mar 23, 2020

This seems to work correctly with typescript@next .. Please let us know if this is still the issue and if it is create a sample repro and provide detail steps. Thanks. #37438 and/or #37387 probably fixed this

@sheetalkamat sheetalkamat added Fixed A PR has been merged for this issue and removed Needs More Info The issue still hasn't been fully clarified labels Mar 23, 2020
@sheetalkamat sheetalkamat self-assigned this Mar 23, 2020
@stefanocke
Copy link
Author

Verified that it works with pnpm and typescript 3.9.0-dev.20200323

@thynson , is it working for you as well with typescript@next?

@thynson
Copy link

thynson commented Mar 24, 2020

💯 It works now.
Hope it could be backported into v3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Auto-import Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants