Next.js Discord

Discord Forum

_document.js unhandledRejection TypeError

Unanswered
Hackberry nipple gall parasitoid posted this in #help-forum
Open in Discord
Hackberry nipple gall parasitoidOP
import getConfig from 'next/config';
import Document, { Head, Html, Main, NextScript } from 'next/document';
class MyDocument extends Document {
    static async getInitialProps(ctx) {
        const initialProps = await Document.getInitialProps(ctx);
        return { ...initialProps };
    }
    render() {
        const contextPath = getConfig().publicRuntimeConfig.contextPath;
        return (
            <Html lang="en">
                <Head>
                    <link id="theme-css" href={`${contextPath}/themes/tailwind-light/theme.css`} rel="stylesheet"></link>
                </Head>
                <body>
                    <Main />
                    <NextScript />
                </body>
            </Html>
        );
    }
}
export default MyDocument;

I'm getting unhandledRejection TypeError: Class extends value #<Object> is not a constructor or null. How can i solve this problem?

0 Replies