Kind of hard to say much based on an image. What errors are you getting in the console?
-
How are you loading the script file in the HTML, are you using
type="module"
on the script element? -
What file is the entry point, i.e. which file is linked to in the HTML? If module 1 is linked to in the HTML then it should have the import and module 2 should have the export.
Example
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="module" src="./mod1.js"></script>
</body>
</html>
mod1.js
import { Person } from './mod2.js';
console.log(Person); // class Person { constructor(name) }
mod2.js
class Person {
constructor(name) {
this.name = name;
}
}
export { Person };
everything is fine there is zero error. still, it 's not working I think i have to change some setting of vs code for modular js.
I don’t see what the editor has to do with anything, how are you running the code?