sandpack css in head in nextjs 13 #906
-
Hi, I have a question regarding support for server side rendering. In the documentation there is a section about server-side rendering which led me to think this is supported for sandpack. I'm using nextjs 13 with app-dir setup. When I add the suggested code to get the rendered css (https://sandpack.codesandbox.io/docs/guides/ssr#nextjs) I get the following error:
So I can only use it with "use client" as far as I can tell but I'd like to keep the code server side instead of client side. Also if I do make it a client component I get an error saying the code on server-side is not the same as client side so can't get it to work fully with the given example in the docs. I tried to add a style-tag in the root-layout because I didn't know how to get it to work on a nested layout now the head is deprecated in nextjs 13 (app-version). But I would prefer this to be on the layout where Sandpack is actually used (which is not the root layout). Does anybody have an example how to set this up correctly in nextjs with the new app-dir structure? It be greatly appreciated and maybe it would be a good candidate to add to the docs as well :-) Thanks in advance for any help and/or insight. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @techmind-git See here: #910 |
Beta Was this translation helpful? Give feedback.
Hey @techmind-git
i just created a PR with a nextjs app dir example that might be helpful to you!
See here: #910