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

259
Views
NextJS - `dev` not working but `build` && `start` do

Created a Next (version: 12.0.7) with Typescript and Storybook. I can build and start the server, however, dev fails once I make a request and spits out this message:

Browser:

Uncaught ReferenceError: __webpack_require__ is not defined

Backend: No error message

I'm using Chakra UI, next-i18next and next-auth.

Reproduce error

  1. Create a next app using typescript npx create-next-app@latest --ts
  2. You will now face the error exports is not defined. Using this hack you can create a custom _document.tsx with this content:
import Document, {
    Html,
    Head,
    Main,
    NextScript,
    DocumentContext,
} from "next/document"

class MyDocument extends Document {
    static async getInitialProps(ctx: DocumentContext) {
        const initialProps = await Document.getInitialProps(ctx)
        return {...initialProps}
    }

    render() {
        return (
            <Html>
                <Head />
                <body>
                <Main />
                <script>var exports = {"{}"};</script>
                <NextScript />
                </body>
            </Html>
        )
    }
}

export default MyDocument
  1. Run yarn run dev
  2. Visit http://localhost:3000/
  3. See console
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I was having a similar issue where next dev would log:

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /.../.env
event - compiled client and server successfully in 6.4s (2106 modules)

But when trying to access the site from Chrome or any other browser, nothing would happen, it would just get stuck loading forever.

It turns out the issue was cause by the VPN I was using (CyberGhost). After disabling it, everything worked again.

about 4 years ago · Juan Pablo Isaza Report

0

FOUND THE TROUBLEMAKER!

When I opened the site in Chrome (which I personally don't use and so it doesn't have any extensions installed), the site worked flawlessly. After some digging, I found out that my Anti-Ad-Blocker was the troublemaker. Disabling it finally solved this error!

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!