How to fix this ES6 module circular dependency?

The answer is to use “init functions”. For reference, look at the two messages starting here: https://esdiscuss.org/topic/how-to-solve-this-basic-es6-module-circular-dependency-problem#content-21 The solution looks like this: // — Module A import C, {initC} from ‘./c’; initC(); console.log(‘Module A’, C) class A extends C { // … } export {A as default} – // — Module B import C, {initC} … Read more

What is the defined execution order of ES6 imports?

JavaScript modules are evaluated asynchronously. However, all imports are evaluated prior to the body of module doing the importing. This makes JavaScript modules different from CommonJS modules in Node or <script> tags without the async attribute. JavaScript modules are closer to the AMD spec when it comes to how they are loaded. For more detail, … Read more