@sdetweil
Modern browsers can directly import ESM through JS regardless it exists locally or externally. . (Anyway, the above code works really.)
Loading ESM via <script type="module">tag will probably be the one way but It will have a global namespace scope. I’m afraid of the risks of collision among MM modules that might be using the same namespace.
getScripts() doesn’t support script type. So some codes for injecting proper script tag is needed by the developer himself,
To load ESM with MM-module-level scoping, using import() and binding the namespace to the MM module would be possible. however, there will be some pitfalls, import() is an asynchronous function. To prevent referencing unloaded ES modules or to avoid handling of DOM by ES Modules before DOM is created, so some tricks might be needed to confirm everything is ready. (Above my code is that.).
So I’m just seeking another or better way if exists.