-
-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn 2 support #678
Comments
I fear we need to do both: make the extension aware of the yarn stuff and add the possibility to chose the TypeScript workspace version. |
@dummdidumm do you have some pointers on how to get this done, where to start etc? |
I just found this: https://github.com/yarnpkg/berry/blob/56cc85a8d3a13d3b3b11c2de066db9b6ccbf758f/packages/yarnpkg-pnpify/sources/sdks/vscode.ts#L95, seems like there might be some work done towards this already |
Interesting. Maybe this means you need to use this setting and then it may work? |
It worked! The steps that worked for me:
|
Great to hear that! I copied your instructions over to the docs. |
This no longer works with 5d7bf1f, you have to set ls-path manually in your user settings |
Thanks for noticing, I'll update the instructions |
Thanks @dummdidumm! That said, it would be nice if there was something akin to |
Just an FYI for people finding this issue. The newest version of Typescript (4.4.x) is not compatible with Yarn PnP, but version 4.3.x is compatible through a patch that yarn pnp automatically applies. Unfortunately(?) svelte-language-server uses the latest typescript by default, breaking yarn pnp support. As a result, the svelte language server won't be able to resolve any imports if you're using yarn pnp in your project. To fix:
in your workspace package.json "resolutions": {
"svelte-language-server/typescript": "~4.3",
"svelte-check/typescript": "~4.3"
}, |
Should this workaround currently work? I have tried it on a fresh skeleton SvelteKit project, but I still get a ERR_MODULE_NOT_FOUND error for the svelte.config.js imports. |
Has anyone gotten this working? I tried SvelteKit for the first time today but am stuck with the same ERR_MODULE_NOT_FOUND error, an adapter in this case. I followed the "Getting started" docs, created the demo app, and dropped it into an existing Yarn 3.1.1 (with workspaces) project. The demo runs (although I had to tweak kit.vite.server.fs.allow to serve the demo font from Yarn's cache), but I can't get the language server working. I followed the "Usage with Yarn 2 PnP" guide (referenced above) and confirmed the pnpified local version is running, as set in ls-path. I tried downgrading typescript to 4.3.5, per the comment above, although it looks like 4.5.5 should work (i.e., it appears to be patched too). I also tried going from Yarn 3.1.1 to 3.2.0-rc.16, per yarnpkg/berry#3722. Any other thoughts? |
Also experiencing Honestly, I think this isn't a TypeScript issue because the import is from |
I think opening a separate issue to track this would be appropriate. |
Is your feature request related to a problem? Please describe.
The Svelte for VSCode extension cannot currently load modules defined in
svelte.config.js
when using Yarn 2. My setup is as follows:This yields the following error when I open a .svelte file with a
<script>
tag:My understanding is that the extension needs to be made aware of Yarn's PnP context to properly load
svelte-preprocess
and any other modulesrequire
d in svelte.config.js.Describe the solution you'd like
With Yarn 2, when one sets up VSCode, some SDKs are generated (for ESlint, Prettier, TypeScript etc).
Describe alternatives you've considered
svelte.config.js
file and having the extension use the default settings (use the version of svelte-preprocess that's bundled with the extension).yarn/sdks/typescript/lib/typescript.js
(generated via https://yarnpkg.com/getting-started/editor-sdks#vscode) to enable loadingsvelte-preprocess
somehow.Additional context
N/A
The text was updated successfully, but these errors were encountered: