Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d89f310

Browse filesBrowse files
committed
module: enable dynamic import flag for esmodules
currently if you want to use dynamic import you must use both the `--experimental-modules` and the `--harmony-dynamic-imports` flags. Chrome is currently shipping dynamic import unflagged, the flag only remains in V8 to guard embedders who have not set the appropriate callback from throwing an unhandled rejection when the feature is used. As such it is reasonable to enable the flag by default for `--experimental-modules` Backport-PR-URL: #17823 PR-URL: #18387 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 00d5422 commit d89f310
Copy full SHA for d89f310

File tree

Expand file treeCollapse file tree

3 files changed

+5
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+5
-3
lines changed
Open diff view settings
Collapse file

‎doc/api/esm.md‎

Copy file name to clipboardExpand all lines: doc/api/esm.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ node --experimental-modules my-app.mjs
3333
### Supported
3434

3535
Only the CLI argument for the main entry point to the program can be an entry
36-
point into an ESM graph. In the future `import()` can be used to create entry
37-
points into ESM graphs at run time.
36+
point into an ESM graph. Dynamic import can also be used to create entry points
37+
into ESM graphs at runtime.
3838

3939
### Unsupported
4040

Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,6 +4077,8 @@ static void ParseArgs(int* argc,
40774077
config_preserve_symlinks = true;
40784078
} else if (strcmp(arg, "--experimental-modules") == 0) {
40794079
config_experimental_modules = true;
4080+
new_v8_argv[new_v8_argc] = "--harmony-dynamic-import";
4081+
new_v8_argc += 1;
40804082
} else if (strcmp(arg, "--loader") == 0) {
40814083
const char* module = argv[index + 1];
40824084
if (!config_experimental_modules) {
Collapse file

‎test/es-module/test-esm-dynamic-import.js‎

Copy file name to clipboardExpand all lines: test/es-module/test-esm-dynamic-import.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --experimental-modules --harmony-dynamic-import
1+
// Flags: --experimental-modules
22
'use strict';
33
const common = require('../common');
44
const assert = require('assert');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.