-
-
Notifications
You must be signed in to change notification settings - Fork 217
Description
Describe the bug
The extension throws the following error with yarn 2 PnP and SvelteKit:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sveltejs/adapter-auto' imported from /home/haowenl/github/lxy-portfolio/svelte.config.js
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:954:9)
at moduleResolve (node:internal/modules/esm/resolve:1003:20)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Reproduction
In a brand new skeleton svelte project, follow these steps: https://github.com/sveltejs/language-tools/tree/master/packages/svelte-vscode#usage-with-yarn-2-pnp.
Expected behaviour
The extension works as normal.
System Info
- OS: Fedora 36, Node v16
- IDE: VSCode
Which package is the issue about?
Svelte for VS Code
Additional Information, eg. Screenshots
I'm not sure this is correct, but I think the node backend shouldn't be using the internal module loader, as shown in the error message above.
To resolve it, I think it should be sufficient to be able to add -r .pnp.cjs --loader .pnp.loader.mjs
generated by yarn, as shown in yarnpkg/berry#638 (comment).
const runExecArgv: string[] = ['--experimental-modules']; |
Hopefully, an option alongside svelte.language-server.runtime
, like svelte.language-server.runtimeArgs
should be sufficient for this.
Other cases of people encountering this: #678 (comment).