Skip to content
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

Vite: Simplify preprocessor to make it work with Svelte 5 and Vite 6 #15274

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

philipp-spiess
Copy link
Member

Closes #15250

This PR simplifies our Vite integration even more. It turns out that in some projects (see #15250 for the exact repro), the way we invoke svelte-preprocess was actually causing issues in Vite since with Vite, it's expected to use the sveltePreprocess version exported by sveltejs/vite-plugin-svelte.

While trying to change this we noticed that there are different versions of sveltejs/vite-plugin-svelte for Vite 5 and Vite 6 which caused us to investigate even more and we noticed that we do not even need to recursively call into the sveltePreprocess() as every plugin is run after each other anyways. This allows us to drop the dependency on svelte-preprocess and simplify the code a bit more, registering only a (string) => string style transformer.

Test Plan

This was tsted on the repro repo from #15250 as well as the SvelteKit setup from my playgrounds. Furthermore we tested various combinations of svelte, @sveltejs/vite-plugin-svelte and vite in our integration test to ensure everything works as expected.

@sgcullen
Copy link

sgcullen commented Dec 2, 2024

Thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4] @tailwindcss/vite crashing dev server with _ has already been declared errors
3 participants