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

160
Vistas
How to import dynamically in Javascript with HTML

my problem is the following: I'm trying to run a JS function with a HTML button, but this error appears each time I click the button:

Uncaught (in promise) ReferenceError: require is not defined

Im pretty sure that it is because I'm using Puppeteer in my JS file, and the function which the button executes uses it.

const puppeteer = require('puppeteer');

I have the import on the top of the file, but I think HTML only executes the function and doesn't read the import.

So the thing here is, can I dynamically import the module inside my function?

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
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