import NextDocument , { Html , Head , Main , NextScript } from 'next/document' ; import { getCssText } from '../stitches.config' ; export default class Document extends NextDocument { static async getInitialProps ( ctx ) { try { const initialProps = await NextDocument . getInitialProps ( ctx ) ; return { ... initialProps , styles : ( < > { initialProps . styles } { } < style id = "stitches" dangerouslySetInnerHTML = { { __html : getCssText ( ) } } /> < />), } ; } finally { } } render ( ) { return ( < Html lang = "en" > < Head /> < body > < Main /> < NextScript / > < /body> < /Html>); } }