Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda