For production #23399
|
I would keep the client and SSR builds separate. The browser should use the CSS files from the client build manifest, not the CSS generated from the SSR graph. Enable build.manifest for the client build, collect the CSS files from the entry and its imports, and inject them into the server-rendered HTML. I would also remove the assetFileNames override because it disables content hashes. Keep CSS code splitting enabled for the client build, and let Vite inject styles in development. |
Replies: 1 comment 1 reply
|
Great points, I completely agree with this approach. Separating the client and SSR builds makes total sense and will clean up the dependency graph issues.I will remove the assetFileNames override to bring back content hashing and enable build.manifest for the client. Then, I'll update the server to parse the manifest, collect the CSS for the entry point and its imports, and inject them into the HTML template. I'll leave Vite to handle style injection in development.I'll ping you once the updates are pushed! |
Great points, I completely agree with this approach. Separating the client and SSR builds makes total sense and will clean up the dependency graph issues.I will remove the assetFileNames override to bring back content hashing and enable build.manifest for the client. Then, I'll update the server to parse the manifest, collect the CSS for the entry point and its imports, and inject them into the HTML template. I'll leave Vite to handle style injection in development.I'll ping you once the updates are pushed!