I've been looking for an answer for days and can't find one. So here it is. I have 3 files. We'll call them main.js, classA.js and classB.js. In the HTML I set the script to module with the arc of main.js.
Now, I import classA and classB in to main without issue. The problem I'm having is classA isn't seeing classB Even though I'm using the same import line for classB in classA.
The console says the classB is undefined. Am I missing something or do I have to put all my classes in one file?
// index.js
import ClassB from ".\ClassB.js"
import ClassA from ".\ClassA.js"
let classA = new ClassA();
// ClassA.js
import ClassB from ".\ClassB.js"
export default class ClassA(){
let classB = new ClassB();
constructor(){}
}
// ClassB
export default class ClassB(){
constructor(){}
}