Open HeadFox opened 3 years ago
Any help on this ? The only solution I see right now for me is to fork the réponse:(
Any update of this ?
Any update of this? I can help if is need it.
Bumping.
I'm also wondering how to solve this. Any updates?
I havent done server side rendering
However I've been playing around with using this plugin and @emotion/css for injection instead of the standard injection So I'm going to throw this here because it may spark ideas of using @emotion to do some server side rendering stuff
styles({
mode: [
"inject",
(varName) => `
const { injectGlobal } = require('@emotion/css');
injectGlobal(${varName});
`,
],
autoModules: true,
modules: true,
}),
You may be able to use docs from emotion to achieve what you're looking for https://emotion.sh/docs/ssr
Currently we need to use a custom injector to be able to retrieve all styles for SSR.
Then we get the global.ssrStyles on our Next.js _document.tsx
My rollup-plugin-styles config (preserveModules enabled):
I didn't find a better way to properly inject my css on server-side. But with this approach we completely loose the ability to use the treeshakeable option.
Do you think that there is a better way to inject our css on server-side render ?