import.source()
The import.source() syntax behaves like regular import() syntax, but only obtains an object representing the module's unevaluated source code. The module can be imperatively evaluated later using a method provided by the source code object.
To use import.source(), the target module has to support source phase imports. Currently, only WebAssembly modules support source phase imports, which result in WebAssembly.Module objects. JavaScript module source objects will be added by the ECMAScript Module Phase Imports proposal.
Syntax
import.source(moduleName)
import.source(moduleName, options)
Parameters
See import().
Return value
Returns a promise. The rejection conditions are largely similar to import(), except that import.source() does not throw exceptions related to module evaluation, because it does not evaluate the module.
If the referenced module is loaded successfully, fulfills with an AbstractModuleSource object representing the module's unevaluated source code.