Replies: 1 comment 8 replies
-
@brillout I see that you started this discussion two years ago. Any ideas on how to process static assets imported by the server? I'm building an app using Hono. All of my pages are rendered server-side on each request, MPA-style, using Hono's JSX renderer as templates. I have a layout template that defines my CSS It would be awesome if there were a way to transform those CSS files using PostCSS, add hashes to the filenames, etc., and for the server to somehow know which file paths to reference in the build output. It would be even more amazing if there were a way to add CSS modules to the whole thing so that I could import a CSS module server side and magically make sure that the appropriate style tags were added to head on render. Right now, I'm using Hono's I wonder if @yusukebe has any ideas. Not sure how much of this would be Hono-specific vs. Vite-specific. |
Beta Was this translation helpful? Give feedback.
-
This not the same discussion as #9496 - Should
$ vite build
also build SSR? which was about the CLI.Regardless of the CLI, and from a technical point of view, separating the client-side and server-side build steps is asking for trouble: fundamentally, we cannot and should not assume that we can build the server-side and client-side in complete isolation from each other.
For example, static assets blur the line between the client and the server. Other techniques such as React Server Components also further blur the line.
A concrete problematic situation is #10082.
Another concrete example is https://vite-plugin-ssr.com/includeAssetsImportedByServer which is a brittle workaround.
I'm creating this ticket as a place to discuss this. (I'm super busy at the moment, maybe I'll find time at some point to further elaborate why React Server Components blurs the line.)
Also CC @aleclarson which I can see to agree with that.
Beta Was this translation helpful? Give feedback.
All reactions