-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
Support Yarn PnP Imports #2196
Support Yarn PnP Imports #2196
Conversation
Code looks good apart from one thing - could you add that setting to the |
The primary purpose of this is to be able to add a Yarn loader for mjs.
Sounds good! Should be done. I also realised that the |
Re commits: Sqash-merging is the norm here, so don't worry about the commit history 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 Let me know when the changes have landed on the other end and we can merge this one
**What's the problem this PR addresses?** My PR sveltejs/language-tools#2196 introduces a small change alongside a new setting that allows sveltejs-language-tools to resolve PnP in ESM files, most importantly in a `svelte.config.js`. Please note that this PR shouldn't go in until that PR is ready as otherwise the Svelte language server itself will not have the setting available. Also I'm no expert in Yarn PnP so if this is the wrong implementation avenue I would welcome advice! **How did you fix it?** The main portion of the solution is in the linked PR. The addition here is to set `svelte.language-server.runtime-args` to `["--loader", "./.pnp.loader.mjs"]`. **Checklist** - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). - [x] I have set the packages that need to be released for my changes to be effective. - [x] I will check that all automated PR checks pass before the PR gets reviewed.
It's been merged in yarnpkg/berry! |
It looks like the tests are now failing:
I'm confused how I could've changed anything that'd impact this test though because the behaviour when not configured should be identical. I suppose I reordered the flags, they used to be |
Don't worry about this one. It's a flaky test. It failed in the master branch a few times as well. It's likely a race condition that only happened in the tests. It is not a blocking issue. I'll try to fix it later. |
Resolves #1514 which describes the crux of the issue. Specifically imports in your
svelete.config.js
won't be able to resolve because they use ESM imports and Node doesn't have a loader set up.This is my first contribution to the repo so let me know if anything doesn't fit the style etc.!
The PR itself is fairly simple but it shouldn't be merged until yarnpkg/berry#5953 is ready as otherwise
yarn dlx @yarnpkg/sdks vscode
won't set up the VSCode setting. Arguably more importantly if the--loader ./.pnp.loader.mjs
approach is inappropriate here I'm sure they'll let me know on that PR!