The static import
statement is used to import read only live bindings which are exported by another module.
Imported modules are in strict mode
whether you declare them as such or not. The import
statement cannot be used in embedded scripts unless such script has a type="module"
. Bindings imported are called live bindings because they are updated by the module that exported the binding.
There is also a function-like dynamic import()
, which does not require scripts of type="module"
.
Backward compatibility can be ensured using attribute nomodule
on the <script>
tag.