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

193
Visualizações
Importing Libraries In Next.js Which Reference The Window Object

I'd like to import dat.gui in my Next.js project, but when importing it the normal way (import * as dat from "dat.gui), I get the error "window is not defined", so apparently the script references the window object somewhere in the initialization. One way to circumvent this is using dynamic imports, but as far as I understand, this means the code from the library is not bundled in the page build but dynamically imported after the page script loaded and started to execute.

It is basically fine, but might be a little bit slower, and also cumbersome to work with as I need to do everything which references the library after the loading process finished. So I wonder, is it also possible to include a library such a dat.gui in the build without running the initialization on the server? Or is my understanding of dynamic imports totally wrong?

about 4 years ago · Santiago Trujillo
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