svelte-preprocess
svelte-preprocess copied to clipboard
Race condition - occasional CSS parsing error during repeated build
Describe the bug Repeating the same build sometimes reports an error parsing valid CSS, while completing successfully other times.
Logs
vite v2.4.4 building SSR bundle for production...
✓ 45 modules transformed.
[vite-plugin-svelte] Unexpected input
file: D:/Work/tmp/src/routes/testing/countdown.svelte
8: </div>
9:
10: <style>@font-face{font-family:Fatherland Faker;src:url(/fonts/Fatherland Faker.otf)}.cd{font-family:Fatherland Faker;vertical-align:150%}</style>
^
> Unexpected input
Stacktrace:
To Reproduce
Although this is currently in a medium-sized project, I have nothing complex in my setup. The file in question is small with plain CSS (originally had lang="postcss"
but removing this changed nothing).
Config is very simple:
preprocess: [
preprocess({
postcss: true,
}),
],
And I've been able to switch out my Netlify adapter for the static adapter without any change in behaviour.
I'm simply clearing cache and rebuilding repeatedly to trigger the issue:
rm -rf .svelte-kit/ build/ functions/ .netlify/ node_modules/.vite/ && npm run build
If necessary I can try to cut this down a simple repro, but I have a strong feeling that this is a timing/race condition issue so it's likely to go away with a different size project.
Expected behavior Consistent build behaviour.
Information about your project:
-
Your operating system: Windows 10, up-to-date. No WSL or Docker involved.
-
svelte-preprocess
version: 4.8.0 (happened on a slightly older version too - updated to test) -
Whether your project uses Webpack or Rollup: Standard new SvelteKit build using Vite.
Obviously this may not be related to svelte-preprocess
but this is my first port of call.
This doesn't seem related to svelte-preprocess
. Closing 🙏