@@ -912,17 +912,14 @@ import packageMain from 'commonjs-package'; // Works
912
912
import { method } from 'commonjs-package'; // Errors
913
913
` ` `
914
914
915
+ It is also possible to
916
+ [import an ES or CommonJS module for its side effects only][].
917
+
915
918
### ` import()` expressions
916
919
917
- Dynamic ` import()` is supported in both CommonJS and ES modules . It can be used
920
+ [ Dynamic ` import()` ][] is supported in both CommonJS and ES modules . It can be used
918
921
to include ES module files from CommonJS code .
919
922
920
- ` ` ` js
921
- (async () => {
922
- await import('./my-app.mjs');
923
- })();
924
- ` ` `
925
-
926
923
## CommonJS , JSON , and Native Modules
927
924
928
925
CommonJS , JSON , and Native modules can be used with
@@ -1716,6 +1713,7 @@ success!
1716
1713
[Babel]: https://babeljs.io/
1717
1714
[CommonJS]: modules.html
1718
1715
[Conditional Exports]: #esm_conditional_exports
1716
+ [Dynamic `import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports
1719
1717
[ECMAScript-modules implementation]: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
1720
1718
[ES Module Integration Proposal for Web Assembly]: https://github.com/webassembly/esm-integration
1721
1719
[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
@@ -1725,13 +1723,14 @@ success!
1725
1723
[`esm`]: https://github.com/standard-things/esm#readme
1726
1724
[`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
1727
1725
[`getFormat` hook]: #esm_code_getformat_code_hook
1728
- [`import()`]: #esm_import-expressions
1726
+ [`import()`]: #esm_import_expressions
1729
1727
[`import.meta.url`]: #esm_import_meta
1730
1728
[`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
1731
1729
[`module.createRequire()`]: modules.html#modules_module_createrequire_filename
1732
1730
[`module.syncBuiltinESMExports()`]: modules.html#modules_module_syncbuiltinesmexports
1733
1731
[`transformSource` hook]: #esm_code_transformsource_code_hook
1734
1732
[dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook
1733
+ [import an ES or CommonJS module for its side effects only]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only
1735
1734
[special scheme]: https://url.spec.whatwg.org/#special-scheme
1736
1735
[the official standard format]: https://tc39.github.io/ecma262/#sec-modules
1737
1736
[the dual CommonJS/ES module packages section]: #esm_dual_commonjs_es_module_packages
0 commit comments