-
-
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
Assume an empty svelte.config.js instead of requiring it? #1683
Comments
We'll need a reproduction in a repository form to know what exactly you are referring to. We do have a fallback preprocessor config. It is likely the fallback config failed to preprocess. But we'll need a reproduction to know why. But I would say if it failed, it means you DO need a svelte.config.js for the diagnostics to correctly show. Assuming an empty one won't help. |
My guess is that the fallback preprocessor only knows about typescript, because the preprocessor might be searched relative to the fallback config which is inside the extension. We somehow would need to point it to the user's node_modules |
Here's a repo that reproduces the error. It's the default Astro project, with a Svelte component added on the index page. https://github.com/ciscoheat/svelte-vscode-issue Commands executed after installing:
|
Yeah. It's because it's using the fallback preprocessor shipped with the extension. Because of that node can't find the sass installed in the workspace. The reason why the language server uses the bundled svelte-preprocess is because of pnpm's strict dependencies rule. The language server can't locate the svelte-preprocess used by Astro under the hood. If you manually install svelte-preprocess it should work fine. This is kind of similar to part of #1259. So you can read the discussion there. In short, we won't want bundle |
I can confirm that installing |
#2452 removes svelte-preprocess, so this situations cannot occur like that anymore, therefore closing |
Describe the bug
I was pointed here after reporting withastro/astro#5065 , the problem seems to be that the VS Code extension requires a
svelte.config.js
that isn't always available, for example when using Sass in a Svelte component in an Astro project, that doesn't have that file in its root folder.Reproduction
When using a Svelte component with Sass styling (<style lang="scss">) in an Astro project, I get a warning in VS Code:
The
sass
package, is installed, which makes it work, but the warning still persists in VS Code, until I follow the advice and add a very simplesvelte.config.js
file to the Astro project, then after restarting VS Code, it's gone:svelte.config.js
Expected behaviour
No problem should be displayed in VS Code.
I'm aware that https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/scss-less.md#2-setting-up-a-svelte-configjs states that "You need a svelte.config.js." but this is quite hard to enforce in other libraries (there are enough boilerplate files in most web projects anyway), so if no
svelte.config.js
exists, could the simplest possible configuration be assumed instead?System Info
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: