Skip to content

Commit a0c7df8

Browse 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 <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent c4c468b commit a0c7df8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

doc/api/esm.md

+2-2
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

src/node.cc

+2
Original file line numberDiff line numberDiff line change
@@ -4154,6 +4154,8 @@ static void ParseArgs(int* argc,
41544154
config_preserve_symlinks = true;
41554155
} else if (strcmp(arg, "--experimental-modules") == 0) {
41564156
config_experimental_modules = true;
4157+
new_v8_argv[new_v8_argc] = "--harmony-dynamic-import";
4158+
new_v8_argc += 1;
41574159
} else if (strcmp(arg, "--loader") == 0) {
41584160
const char* module = argv[index + 1];
41594161
if (!config_experimental_modules) {

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

+1-1
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)