-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Duplicate CSS rules after build #10379
Comments
This comment was marked as spam.
This comment was marked as spam.
I believe this is because in the SSR output we have a link tag, and it's also being added by the hydration step. I don't think this would be considered a bug, or even fixed - I myself am not sure how to. At the very least I wouldn't worry about it since it's not causing duplicated network requests 🙏 |
It's a bit annoying regarding DX. When creating layouts, I usually iterate a lot of possibilities in the browser dev tools before writing the actual CSS. When the CSS is duplicated, I have to turn off CSS rules two times. I also don't think it's normal, I spent quite some time debugging believing it was an issue on my end. |
Taking a look at the source code I found two parts that seem to be related to the issue. The comments mention double parsing in Chromium and double requests in Firefox. I tried changing the kit/packages/kit/src/exports/public.d.ts Lines 453 to 463 in b251b23
This part is also relevant. Somehow it seems that this loop runs twice and the link tags are added each time. kit/packages/kit/src/runtime/server/page/render.js Lines 282 to 290 in b251b23
|
Iirc the issue is only present after building with static adapter? |
@stefandevai A temporary workaround is to turn off SSR or set // routes/+layout.svelte
export const prerender = true;
export const ssr = false; I tested and it seems to happen to the node adapter too. Currently only affects Chrome and Firefox (Safari on macOS doesn't parse the stylesheet twice). I'm not sure how to fix this but maybe Kit can always set SSR to false if prerender is true? EDIT: seems this isn't related to prerendering at all. It happens when |
Describe the bug
Hello everyone!
I'm building a personal blog and for for some reason the link tags containing css files are duplicated in production only. In dev mode everything looks fine. For this reason, every style is duplicated.
I've created a repo and added only @sveltejs/adapter-static and the issue remained.
Thanks in advance.
Reproduction
https://github.com/stefandevai/duplicated-css
background: orange;
is shown twiceLogs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: