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

126
Vistas
Why does using import break a module?

Why am I getting an error saying my function is undefined when I import a module?

I have a simple JavaScript module and whenever I import ethers, my functions display as no longer defined.

Before importing ethers

<button type="button" onclick="run();">Run my stuff</button>

<script type="module">
  function run() { 
      console.log("Hello world!") 
  } 
  window.run = run;
</script>

After importing ethers

<button type="button" onclick="run();">Run my stuff</button>

<script type="module">
  import { ethers } from "https://cdn.ethers.io/lib/ethers-5.2.esm.min.js";
  
  function run() { 
      console.log("Hello world!") 
  } 
  window.run = run;
</script>

Why is this happening?

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