-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Vite 6: module.ssrModule is empty for styles modules during SSR in development #19205
Comments
Hello @fallemand. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
@bluwy, added a reproduction. |
This is an intended breaking change:
|
Is there a way to get the CSS content of a module in dev SSR? |
I was able to get the CSS content in SSR Dev with const injectQuery = (url: string, query: string) =>
url.includes("?") ? url.replace("?", `?${query}&`) : `${url}?${query}`;
const cssContent = await vite.ssrLoadModule(injectQuery(moduleUrl, "inline")); |
Describe the bug
With Vite 5, we were able to inject in the SSR response the styles in the
<head>
by using the module graph.How can I get the mod.ssrModule to be loaded in Vite 6?
Reproduction
Vite 6:
https://stackblitz.com/edit/github-nevztk-b3pqix6j?file=src%2Fentry-server.ts
Vite 5:
https://stackblitz.com/edit/github-nevztk-swmbdpcw?file=package.json
Steps to reproduce
npm i & npm run dev
In the
node
console you'll see the output of themod.ssrModule
for a style module, and a normal module.In the case of the style it's an empty object.
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: