Open
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version:
1.71.2
- OS Version:
Windows 11
Steps to Reproduce:
-
Configure a tsconfig.json which has alias paths to node_modules
{ "compilerOptions": { "allowJs": true, "jsx": "react", "baseUrl": ".", "checkJs": true, "noEmit": true, "esModuleInterop": true, "resolveJsonModule": true, "paths": { "theme/*": [ "./src/web/theme/*", "./node_modules/my-library/my-module-a/web/theme/*", "./node_modules/my-library/my-module-b/web/theme/*", "./node_modules/my-library/my-module-c/web/theme/*", ], "web/*": [ "./src/web/*", "./node_modules/my-library/my-module-a/web/*", "./node_modules/my-library/my-module-b/web/*", "./node_modules/my-library/my-module-c/web/*", ], "server/*": ["./node_modules/my-library/src/server/*"], "config/*": [ "./src/config/*", "./node_modules/my-library/my-module-a/config/*", "./node_modules/my-library/my-module-b/config/*", "./node_modules/my-library/my-module-c/config/*", ], } } }
-
Try to import an existing file under the alias in node_modules
The autocomplete would prefer to use the my-library
as a package instead of the shorter alias path, for example it would suggest:
import Image from "my-library/my-module-a/web/theme/Image"
import Image from "my-library/my-module-b/web/theme/Image"
import Image from "my-library/my-module-c/web/theme/Image"
But it will not suggest:
import Image from "theme/Image"
although that alias works perfectly fine when adding it manually.