Closed sortofsleepy closed 9 months ago
native css nesting isn't supported in svelte4 by itself, some parts of it work but thats because svelte4 uses css-tree. svelte5 does not and hasn't implemented native css nesting yet.
To work around this, use a preprocessor that converts nested syntax to unnested. This can be done with postcss or lightningcss (experimental option on vite)
see https://github.com/sveltejs/svelte/issues/8587 and https://github.com/sveltejs/svelte/pull/9343
closing here as it is not caused by vite-plugin-svelte. Please follow the issues on svelte repo for updates.
Describe the bug
Not sure if this is the right spot to report, but since the error window mentions this plugin specifically, figured I'd start here.
Anyways, not sure if I'm doing something wrong but in the current stable version of Svelte, the following component compiles and functions as expected
However in the current Svelte 5 beta, an error is triggered saying
Expected a valid CSS identifier
. This is tested from a fresh install of SvelteKit runningnpm create svelte@latest
afterwards running
npm install svelte@next
to install Svelte 5
Not sure how support was implemented in Svelte 4 but it'd be great to have this working in the final release without having to download another package.
Reproduction URL
https://github.com/sortofsleepy/svelte5-vite-css-error
Reproduction
npm i svelte@latest
to compare and contrast.Logs
System Info