Skip to content

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

Merged
thecrypticace merged 10 commits into
nextfrom
fix/vite-preprocessor
Dec 2, 2024
Merged

Vite: Simplify preprocessor to make it work with Svelte 5 and Vite 6#15274
thecrypticace merged 10 commits into
nextfrom
fix/vite-preprocessor

Conversation

@philipp-spiess

Copy link
Copy Markdown
Contributor

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

sgcullen commented Dec 2, 2024

Copy link
Copy Markdown

Thanks for working on this!

Comment thread packages/@tailwindcss-vite/package.json Outdated
It’s not necessary
We require at least Vite 5.2 but also support Vite 6
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