How can I import a class from another file within a file imported by a module in electron (or is this just the completly wrong way and you shouldn't do nested imports; and if, what you should do instead)?
If I try, I get the following error:
Uncaught SyntaxError: Unexpected identifier
That is the example code:
//index.html
...
<script src="script1.js" type="module"></script>
...
//script1.js
import Class1 from './script2.js';
const class1 = new Class1();
//script2.js
class Class1 {
constructor() {
//doStuff
import Class2 from './script3.js';
const class2 = new Class2();
}
}
export default Class1;
//script3.js
class Class2 {
constructor() {
//doStuff
console.log("Class2");
}
}
export default Class2;