Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

255
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda