-
According to https://remix.run/docs/en/main/future/vite I am running basic remix vite project with multiple css imports in multiple components. Despite having a style tag for every individual css import, I am seeing one extra style tag that contains the content of all other css files. Is this a bug? Update: The one extra style tag that contains the content of all other css files is related to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I don't think such duplicate is intended. Could you elaborate your setup in more detail? or simple repro would be appreciated.
Also, if it's an issue of I'm experimenting with a simple example here https://stackblitz.com/edit/remix-run-remix-ftk8p1?file=app%2Froutes%2Ftest3.tsx but so far, css code split seems fine and I cannot reproduce duplicate css. |
Beta Was this translation helpful? Give feedback.
Ah, but if you are seeing something like this on
dev
, then currently this is a way for remix to prevent FOUC during dev:The first
<style>
is what remix calls "critical css" which are included in SSR to prevent FOUC, then other<style>
is injected by vite using client js.After the first HMR, the first
<style>
is removed by remix so that vite can take over css HMR. So I think having duplicate css on "initial SSR + initial client render" are not expected to cause any issue.(But if you are observing inconsistent style potentially due to this, then I think that's worth a bug report).