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?
from '/js/person.js';->from 'js/person.js';probably. You're importing from different paths. And I don't think you need to add person.js on the page itself, script.js referencing it should be enough.TypeError: Module specifier, 'js/person.js' does not start with "/", "./", or "../".from './person.js'SyntaxError: Importing binding name 'Person' is not found.error.