These use the module loader system in the Browser.
When a module is loaded, it has a special name that is only available within this module loader system. The special name is why import
doesn't work with modules that import
other modules using that special name, because import()
cannot assign that name.
Loading is possible with:
import
is capable of loading the module's script and setting the special name of the module. This allows other modules to access it. It is not capable ofload
orerror
events or a retry function or subresource integrity.import()
is capable of a Promise but it does not allow access to the special name of the module and does not have subresource integrity.