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

192
Vistas
Javascript Module Import and Export not Working (Importing binding name is not found.)

I've scoured SO and the Web for answers, but have found nothing so far that has helped. When navigating to my test site (see below), I'm getting this error: Importing binding name 'Person' is not found.

From index.html:

<script type="module" src="js/person.js"></script>
<script type="module" src="js/script.js"></script>

From script.js:

import {Person} from '/js/person.js';

From person.js:

export class Person {
  constructor(
    firstName, lastName, email
  ){
    this.firstName = firstName;
    this.lastName = lastName;
    this.email = email;
  }

  setFirstName(firstName){
    this.firstName = firstName;
  }

  setLastName(lastName){
    this.lastName = lastName;
  }

  setEmail(email){
    this.email = email;
  }

}

All the documentation I've found appears to indicate that I'm doing this correctly, and yet I get the error. Any ideas, anyone?

UPDATE Everything works fine under Windows, but not using MacOS 12 in Safari, Firefox, or Chrome. Why?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Issue resolved; I was using the 'Live Server' plugin in VS Code on MacOS to serve the site which apparently caused the problem (although under Windows, it works just fine). When serving it with Apache on MacOS, it works.

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