There are a simple and standard way to import a class and reuse it globally?
This solution is not good: needs an intermediary script... And it is ugly, need redundant declarations, and not seems so performatic. It is very strange:
<script type="module" src="./MyClass.js"></script>
<script type="module" id="_the_intermediary_script_">
'use strict';
import MyClass from './MyClass.js';
window.MyClassRef = MyClass; // "globalizing" class
</script>
<script> // NON-module global script
// no way to directelly import here??
document.addEventListener('DOMContentLoaded',function(){
// only works after all modules loaded:
let x = new window.MyClassRef(22); // ... after all is an ugly way!
}, false); //ONLOAD
</script>
There is a way to import class without an intermediary script?
Note: I not need "dynamic load" to import, I need to load the class as any other library , with traditional static library include. I can use modern (last version) browsers, with modern Javascript/ECMAScript interpreter.