Description
Bug Report
π Search Terms
autoimportprovider bundler
π Version & Regression Information
This is related to a 5.0.0@next
version feature. TS version in my app: 5.0.0-dev.20230109
β― Playground Link
The bug is related to an editor feature, so I don't have a playground link.
π» Code
App tsconfig.json (note: everything is probably irrelevant here except the "moduleResolution": "Bunder",
line):
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"paths": {
"src/*": ["./src/*"]
}
},
"include": ["src"]
}
Company library has a Button (react component) export in the /lib/engie/index.tsx
file, here's a library package.json excerpt:
{
"name": "@company/common",
...
"exports": {
".": "./lib/index.tsx",
"./engie": "./lib/engie/index.tsx"
},
π Actual behavior
When I type <Button
in an app source file, VSCode offers the import from @company/common/lib/engie
. When I accept the auto import, the import line shows the error "Cannot find module ...". When I manually delete the lib/
part, the error disappears.
π Expected behavior
VSCode should offer the import from @company/common/engie
. When I change app tsconfig moduleResolution to "NodeNext" or "Node16", and I delete the import line from the app source and try again, it offers the correct @company/common/engie
path.