-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Closed as not planned
Copy link
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
🔎 Search Terms
pnpm virtual-store-dir plugin resolve
🕗 Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
No response
💻 Code
https://codesandbox.io/p/devbox/5t3rgv
🙁 Actual behavior
see .vscode/settings.json:
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsserver.log": "terse"
}and .npmrc:
virtual-store-dir=${HOME}/.cache/pnpm-virtual-store
and tsconfig.json:
...
"plugins": [
{
"name": "next"
}
],Using workspace version of typescript with custom pnpm virtual-store-dir fails to load plugins
- Install dependencies
- Open ts file
- Press cmd+shift+p
- type
open tsserver logand select command - You will find this logs:
Info 13 [07:41:44.241] Enabling plugin next from candidate paths: /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js/../../..
Info 14 [07:41:44.241] Loading next from /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js/../../.. (resolved to /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/node_modules)
Info 15 [07:41:44.256] Failed to load module 'next' from /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/node_modules: Error: Could not resolve JS module 'next' starting at '/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/node_modules'. Looked in: /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/next/package.json, /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/next.js, /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/next.jsx, /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/next/index.js, /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/next/index.jsx, /root/.cache/pnpm-virtual-store/node_modules/next/package.json, /root/.cache/pnpm-virtual-store/node_modules/next.js, /root/.cache/pnpm-virtual-store/node_modules/next.jsx, /root/.cache/pnpm-virtual-store/node_modules/next/index.js, /root/.cache/pnpm-virtual-store/node_modules/next/index.jsx, /root/.cache/node_modules/next/package.json, /root/.cache/node_modules/next.js, /root/.cache/node_modules/next.jsx, /root/.cache/node_modules/next/index.js, /root/.cache/node_modules/next/index.jsx, /root/node_modules/next/package.json, /root/node_modules/next.js, /root/node_modules/next.jsx, /root/node_modules/next/index.js, /root/node_modules/next/index.jsx, /node_modules/next/package.json, /node_modules/next.js, /node_modules/next.jsx, /node_modules/next/index.js, /node_modules/next/index.jsx
at resolveJSModule (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:44657:11)
at Object.require (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:8385:30)
at Function.importServicePluginSync (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:185646:27)
at _ProjectService.requestEnablePlugin (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:191532:16)
at ConfiguredProject2.enablePlugin (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:186944:25)
at ConfiguredProject2.enablePluginsWithOptions (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:187700:14)
at _ProjectService.loadConfiguredProject (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:189606:13)
at _ProjectService.reloadConfiguredProject (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:189880:10)
at ConfiguredProject2.updateGraph (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:187629:29)
at updateWithTriggerFile (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:188177:11)
at updateConfiguredProject (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:188185:9)
at updateProjectFoundUsingFind (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:188120:28)
at _ProjectService.findCreateOrReloadConfiguredProject (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:190771:62)
at _ProjectService.tryFindDefaultConfiguredProjectForOpenScriptInfo (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:190806:25)
at _ProjectService.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:190964:25)
at _ProjectService.assignProjectToOpenedScriptInfo (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:190717:27)
at /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:191270:27
at Array.forEach (<anonymous>)
at _ProjectService.applyChangesInOpenFiles (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:191267:56)
at updateOpen (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:192499:29)
at /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:195218:15
at IpcIOSession.executeWithRequestId (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:195207:14)
at IpcIOSession.executeCommand (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:195216:29)
at IpcIOSession.onMessage (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js:195264:68)
at process.<anonymous> (/root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/_tsserver.js:525:14)
at process.emit (node:events:513:28)
at emit (node:internal/child_process:946:14)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Info 16 [07:41:44.256] Couldn't find next
The problem is that path to tsserver is resolved to the custom pnpm virtual-store-dir and it is impossible to resolve path to plugin from it.
The path comes from here https://github.com/microsoft/TypeScript/blob/main/src/server/project.ts#L2109
Why it does not return node_modules/typescript/lib and instead return /root/.cache/pnpm-virtual-store/typescript@5.7.2/node_modules/typescript/lib/typescript.js/../../..?
🙂 Expected behavior
Plugin starts correctly using pnpm custom virtual-store-dir
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code