garronej / tss-react

✨ Dynamic CSS-in-TS solution, based on Emotion
https://tss-react.dev
MIT License
590 stars 38 forks source link

Next.js: Applying augmentDocumentWithEmotionCache to document breaks AMP pages #203

Open tiotdev opened 7 months ago

tiotdev commented 7 months ago

_document.js:

import Document from 'next/document';
import { augmentDocumentWithEmotionCache } from './_app';

//You can also pass your custom document if you have one.
augmentDocumentWithEmotionCache(Document);

export default Document;

Amp pages show TypeError: Cannot read properties of undefined (reading '__html')

Without tss-react no issues:

import Document from 'next/document';

export default Document;
garronej commented 7 months ago

Hello @tiotdev,

Thanks for reaching out. Would you produce a reproduction repo?

garronej commented 7 months ago

Well I tested with a next.js page router starter in vanilla javascript just to make sure it works.
Nothing to report.
image image image image

Maybe try copy pasting precisely what ther's in the doc: https://docs.tss-react.dev/ssr/next.js