@@ -929,17 +929,14 @@ import packageMain from 'commonjs-package'; // Works
929929import { method } from 'commonjs-package'; // Errors
930930` ` `
931931
932+ It is also possible to
933+ [import an ES or CommonJS module for its side effects only][].
934+
932935### ` import()` expressions
933936
934- Dynamic ` import()` is supported in both CommonJS and ES modules . It can be used
937+ [ Dynamic ` import()` ][] is supported in both CommonJS and ES modules . It can be used
935938to include ES module files from CommonJS code .
936939
937- ` ` ` js
938- (async () => {
939- await import('./my-app.mjs');
940- })();
941- ` ` `
942-
943940## CommonJS , JSON , and Native Modules
944941
945942CommonJS , JSON , and Native modules can be used with
@@ -1737,6 +1734,7 @@ success!
17371734[Babel]: https://babeljs.io/
17381735[CommonJS]: modules.html
17391736[Conditional Exports]: #esm_conditional_exports
1737+ [Dynamic `import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports
17401738[ECMAScript-modules implementation]: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
17411739[ES Module Integration Proposal for Web Assembly]: https://github.com/webassembly/esm-integration
17421740[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
@@ -1748,13 +1746,14 @@ success!
17481746[`esm`]: https://github.com/standard-things/esm#readme
17491747[`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
17501748[`getFormat` hook]: #esm_code_getformat_code_hook
1751- [`import()`]: #esm_import-expressions
1749+ [`import()`]: #esm_import_expressions
17521750[`import.meta.url`]: #esm_import_meta
17531751[`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
17541752[`module.createRequire()`]: modules.html#modules_module_createrequire_filename
17551753[`module.syncBuiltinESMExports()`]: modules.html#modules_module_syncbuiltinesmexports
17561754[`transformSource` hook]: #esm_code_transformsource_code_hook
17571755[dynamic instantiate hook]: #esm_code_dynamicinstantiate_code_hook
1756+ [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
17581757[special scheme]: https://url.spec.whatwg.org/#special-scheme
17591758[the official standard format]: https://tc39.github.io/ecma262/#sec-modules
17601759[transpiler loader example]: #esm_transpiler_loader
0 commit comments