You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"intellisense not working", "auto import", "autoimport", "internal package", "monorepo internal"
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries "tsconfig.json Behavior" and other mentions of "import" "intellisense" or "module".
Versions checked
❯ every-ts switch main
HEAD is now at 5df3a107c0 Update dependencies (#58639)
❯ every-ts switch 5.5
HEAD is now at b574864abc Update LKG
❯ every-ts switch 5.1
HEAD is now at 6e4aa901f2 Bump version to 5.1.6 and LKG
❯ every-ts switch 4.8
HEAD is now at a614119c19 Bump version to 4.8.4 and LKG
❯ every-ts switch 5.5
HEAD is now at b574864abc Update LKG
❯ every-ts switch 5.3
HEAD is now at 3a36bec244 🤖 Pick PR #56626 (Directly copy only the index signat...) into release-5.3 (#56709)
❯ every-ts switch 5.2
HEAD is now at 9684ba6b0d Cherry-pick fix for cross-file inlay hints (#55476) to release-5.2 and LKG (#55487)
I've used VS Code Insiders so I don't have any excess extensions (just WSL).
constPage=()=>{// import suggestion for lodash is workingconstbar=sum(1,2)// internal @repo/ui package exports don't workconstfoo=getFoo();constbar=getBar();return(// also not in jsx<Card><h1>Hello, world!</h1><p>Welcome to your new app!</p></div>);};exportdefaultPage;
Import suggestions for an internal package stop working if the number of installed dependencies grows too large. This already happens with as little as ~12 dependencies.
Reproduction
The reprodution repo is basically just Turborepo's basic example with a few dependencies added to showcase the autoimport failing.
Open apps/web/app/page.tsx and try to import-suggest the getFoo function.
Observe it not working.
Observing the strange behavior
Remove a few dependencies (e.g. the first 3, I didn't try removing next, react or react-dom)
Rerun pnpm i to remove them from node_modules.
Restart the TS Server in VS Code.
Observe the import suggestion showing the internal package import.
You can remove any other dependencies (as shown in the video). It doesn't matter which ones. I tried the following
"@clerk/localizations": "^2.4.3", // <-- Group 1"@clerk/nextjs": "^5.1.2", // <-- Group 1"@tanstack/react-query": "^5.39.0", // <-- Group 1"@trpc/client": "11.0.0-rc.377",
"@trpc/react-query": "11.0.0-rc.377",
"@trpc/server": "11.0.0-rc.377", // <-- Group 3, not shown in the video"@upstash/redis": "^1.31.3", // <-- Group 3, not shown in the video"@repo/ui": "workspace:*",
"lodash": "^4.17.21",
"next": "^14.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"superjson": "^2.2.1", // <-- Group 2"zod": "^3.23.8"// <-- Group 2
Removing any ?random? group of packages, makes the import work.
2024-05-30.09-27-16.mp4
Note
The imports start showing up, if at least one file in the project has imported the file already.
E.g. page.tsx imports
import{getFoo}from"@repo/ui/get-foo";
then, all imports from "@repo/ui/get-foo" are available when triggering the suggestion. Even if we are in e.g. layout.tsx.
But the imports from other paths of the internal package e.g. "@repo/ui/get-foobar" are not.
🙂 Expected behavior
I expect the imports to be working regardless of how many dependencies I have installed.
Thank you so much! This seems to fix it 😀
Now, since it's not the default, I have to ask: What are the implications regarding performance if I enable that?
Maybe there could be some kind of whitelist, so we can include the internal packages in the VS Code settings?
Uh oh!
There was an error while loading. Please reload this page.
🔎 Search Terms
"intellisense not working", "auto import", "autoimport", "internal package", "monorepo internal"
🕗 Version & Regression Information
Versions checked
I've used VS Code Insiders so I don't have any excess extensions (just WSL).
⏯ Playground Link
No response
💻 Code
Reproduction Repo
See:
https://github.com/michaelschufi/repro-monorepo-tsserver-import
Internal Package
package.json
get-foo.ts
pnpx tsc --showConfig
App using internal package
package.json
page.tsx
pnpx tsc --showConfig
🙁 Actual behavior
Import suggestions for an internal package stop working if the number of installed dependencies grows too large. This already happens with as little as ~12 dependencies.
Reproduction
The reprodution repo is basically just Turborepo's basic example with a few dependencies added to showcase the autoimport failing.
from (Turborepo Getting Started).
It uses the strategy for internal packages outlined here Turborepo Internal Packages - which is already preconfigured in the example.
Initial Steps
apps/web
folder.pnpm i
apps/web/app/page.tsx
and try to import-suggest thegetFoo
function.Observing the strange behavior
next
,react
orreact-dom
)pnpm i
to remove them fromnode_modules
.You can remove any other dependencies (as shown in the video). It doesn't matter which ones. I tried the following
Removing any ?random? group of packages, makes the import work.
2024-05-30.09-27-16.mp4
Note
The imports start showing up, if at least one file in the project has imported the file already.
E.g.
page.tsx
importsthen, all imports from
"@repo/ui/get-foo"
are available when triggering the suggestion. Even if we are in e.g.layout.tsx
.But the imports from other paths of the internal package e.g.
"@repo/ui/get-foobar"
are not.🙂 Expected behavior
I expect the imports to be working regardless of how many dependencies I have installed.
Additional information about the issue
Possibly related issues:
Below are the tsserver logs. Note the following lines in the first one
https://gist.github.com/michaelschufi/638a0a9bc5bc8568c86b50a8c0c0e723
The text was updated successfully, but these errors were encountered: