mjs module looks like:
var Module = (() => {
var _scriptDir = import.meta.url;
return (
async function(Module = {}) {
var Module = typeof Module != "undefined" ? Module : {};
// module stuff
}
);
})();
export default Module;
There are a few problems with this:
- Safari doesn't understands this and I truly believe the cause is a Safari bug (tested under Safari 16.4 MacOS / iOS)
- Default argument value assumes that argument is defined
- Hoisting doesn't work here, es module provides module scope
You could really name things better. The first Module actually is a factory that generates a Module, the second one is Module closure and the third one is the Module, which is the factory result.
mjs module looks like:
There are a few problems with this:
You could really name things better. The first Module actually is a factory that generates a Module, the second one is Module closure and the third one is the Module, which is the factory result.