import Document , { Html , Head , Main , NextScript , DocumentContext , } from 'next/document' ; import { ColorModeScript } from '@chakra-ui/react' ; class MyDocument extends Document { static async getInitialProps ( ctx ) { return await Document . getInitialProps ( ctx ) ; } render ( ) { return ( < Html > < Head /> < body > < ColorModeScript /> < Main / > < NextScript /> < /body> < /Html>); } } export default MyDocument ;