@@ -929,17 +929,14 @@ import packageMain from 'commonjs-package'; // Works
929
929
import { method } from 'commonjs-package'; // Errors
930
930
` ` `
931
931
932
+ It is also possible to
933
+ [import an ES or CommonJS module for its side effects only][].
934
+
932
935
### ` import()` expressions
933
936
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
935
938
to include ES module files from CommonJS code .
936
939
937
- ` ` ` js
938
- (async () => {
939
- await import('./my-app.mjs');
940
- })();
941
- ` ` `
942
-
943
940
## CommonJS , JSON , and Native Modules
944
941
945
942
CommonJS , JSON , and Native modules can be used with
@@ -1737,6 +1734,7 @@ success!
1737
1734
[Babel]: https://babeljs.io/
1738
1735
[CommonJS]: modules.html
1739
1736
[Conditional Exports]: #esm_conditional_exports
1737
+ [Dynamic `import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports
1740
1738
[ECMAScript-modules implementation]: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
1741
1739
[ES Module Integration Proposal for Web Assembly]: https://github.com/webassembly/esm-integration
1742
1740
[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
@@ -1748,13 +1746,14 @@ success!
1748
1746
[`esm`]: https://github.com/standard-things/esm#readme
1749
1747
[`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
1750
1748
[`getFormat` hook]: #esm_code_getformat_code_hook
1751
- [`import()`]: #esm_import-expressions
1749
+ [`import()`]: #esm_import_expressions
1752
1750
[`import.meta.url`]: #esm_import_meta
1753
1751
[`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
1754
1752
[`module.createRequire()`]: modules.html#modules_module_createrequire_filename
1755
1753
[`module.syncBuiltinESMExports()`]: modules.html#modules_module_syncbuiltinesmexports
1756
1754
[`transformSource` hook]: #esm_code_transformsource_code_hook
1757
1755
[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
1758
1757
[special scheme]: https://url.spec.whatwg.org/#special-scheme
1759
1758
[the official standard format]: https://tc39.github.io/ecma262/#sec-modules
1760
1759
[transpiler loader example]: #esm_transpiler_loader
0 commit comments