Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
I am trying to fix this error but nothing is working

I have an error with web packs and nextjs.

import NextDocument, { Html, Head, Main, NextScript } from 'next/document'
import theme from '../libs/theme.js'

export default class Document extends NextDocument {
  render() {
    return (
      <Html lang="en">
        <Head />
        <ColorModeScript initialColorMode={ theme.config.initialColorMode }  />
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    )
  }
}

Error: ReferenceError: Cannot access 'WEBPACK_DEFAULT_EXPORT' before initialization.

   9 |   <Head />
> 10 |   <ColorModeScript initialColorMode={ theme.config.initialColorMode }  />
     |                                      ^
  11 |   <body>
  12 |     <Main />
  13 |     <NextScript />

Does anyone know a fix? Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As mentioned in the comments above try moving your script into the <body> (or into the <Head/>)

<Head />
<body>
  <ColorModeScript initialColorMode={ theme.config.initialColorMode }  />
</body>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!