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`

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Myles Borins 2018-01-25 14:32:43 -08:00
parent 6bcd31f2f4
commit ba3d55a3b8
No known key found for this signature in database
GPG Key ID: 933B01F40B5CA946
3 changed files with 5 additions and 3 deletions

View File

@ -33,8 +33,8 @@ node --experimental-modules my-app.mjs
### Supported
Only the CLI argument for the main entry point to the program can be an entry
point into an ESM graph. Dynamic import can also be used with the flag
`--harmony-dynamic-import` to create entry points into ESM graphs at runtime.
point into an ESM graph. Dynamic import can also be used to create entry points
into ESM graphs at runtime.
### Unsupported

View File

@ -3678,6 +3678,8 @@ static void ParseArgs(int* argc,
config_preserve_symlinks = true;
} else if (strcmp(arg, "--experimental-modules") == 0) {
config_experimental_modules = true;
new_v8_argv[new_v8_argc] = "--harmony-dynamic-import";
new_v8_argc += 1;
} else if (strcmp(arg, "--experimental-vm-modules") == 0) {
config_experimental_vm_modules = true;
} else if (strcmp(arg, "--loader") == 0) {

View File

@ -1,4 +1,4 @@
// Flags: --experimental-modules --harmony-dynamic-import
// Flags: --experimental-modules
'use strict';
const common = require('../common');
const assert = require('assert');