const Module = (() => {
class Module {
init() {
alert('it works!')
}
}
return Module
})()
export default Module
import Module from './module'
export { Module }
<script src="app.js"></script>
<script>
Module.init();
</script>
import Module from './module.js'
export default { Module }
<script type="module" src="app.js"></script>
<script type="module">
import App from './app.js'
console.warn(App.Module);
</script>