Skip to content

Commit 8015b0f

Browse files
committed
src: conditionally disable source phase imports by default
1 parent 82fc81c commit 8015b0f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/node.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,9 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
780780
env_opts->abort_on_uncaught_exception = true;
781781
}
782782

783-
v8_args.emplace_back("--js-source-phase-imports");
783+
if (per_process::cli_options->js_source_phase_imports) {
784+
v8_args.emplace_back("--js-source-phase-imports");
785+
}
784786

785787
#ifdef __POSIX__
786788
// Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the

src/node_options.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,10 @@ PerProcessOptionsParser::PerProcessOptionsParser(
14191419
"performance.",
14201420
&PerProcessOptions::disable_wasm_trap_handler,
14211421
kAllowedInEnvvar);
1422+
AddOption("--js_source_phase_imports",
1423+
"Enable JavaScript source phase imports.",
1424+
&PerProcessOptions::js_source_phase_imports,
1425+
kAllowedInEnvvar);
14221426
}
14231427

14241428
inline std::string RemoveBrackets(const std::string& host) {

src/node_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ class PerProcessOptions : public Options {
368368
#endif
369369

370370
bool disable_wasm_trap_handler = false;
371+
bool js_source_phase_imports = false;
371372

372373
// Per-process because reports can be triggered outside a known V8 context.
373374
bool report_on_fatalerror = false;

0 commit comments

Comments
 (0)