Summary: This introduces a function-like import() syntax to JS that imports an ES6 module and returns a promise for that module's namespace.
We currently support static module imports and these should be used where possible. However sometimes it's desirable to dynamically load code at runtime, for example to allow a module to be chosen based on information only known at runtime, or to support lazy loading of infrequently-used code. Note that use of this feature is not restricted to ES6 modules but can be used to load modules from classic scripts. Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Link to standard: This is currently a TC39 stage 3 proposal: https://github.com/tc39/proposal-dynamic-import HTML spec changes: https://github.com/whatwg/html/pull/3044 Platform coverage: All platforms. Estimated or target release: 65 Preference behind which this will be implemented: javascript.options.dynamicImport Is this feature enabled by default in sandboxed iframes? This features requires script execution and is allowed where script execution is allowed. DevTools bug: I don't know whether there is DevTools work to do here or not. Do other browser engines implement this? Chrome shipped this in 63, Safari in 11.1, and it's in development in Edge. web-platform-tests: https://github.com/web-platform-tests/wpt/tree/master/html/semantics/scripting-1/the-script-element/module/dynamic-import Is this feature restricted to secure contexts? No, it's not restricted as it's part of script execution and works everywhere that is allowed. Jon _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform