Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

Commit 2de50e3

Browse files
committed
esm: rename flag --esm-extension-resolution
There are currently two supported values "none" and "cjs"
1 parent 2168312 commit 2de50e3

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

default.profraw

2.01 KB
Binary file not shown.

src/module_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ inline Maybe<URL> ResolveIndex(const URL& search) {
699699
Maybe<URL> FinalizeResolution(Environment* env,
700700
const URL& resolved,
701701
const URL& base) {
702-
if (env->options()->legacy_resolution) {
702+
if (env->options()->esm_extension_resolution == "cjs") {
703703
Maybe<URL> file = ResolveExtensions<TRY_EXACT_NAME>(resolved);
704704
if (!file.IsNothing()) {
705705
return file;

src/node_options.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
236236
"(default: llhttp).",
237237
&EnvironmentOptions::http_parser,
238238
kAllowedInEnvironment);
239-
AddOption("--legacy-resolution",
240-
"legacy extension and folder resolution for ES Modules",
241-
&EnvironmentOptions::legacy_resolution,
239+
AddOption("--esm-extension-resolution",
240+
"Select extension resolution algorithm for esm; either 'none' or 'cjs'",
241+
&EnvironmentOptions::esm_extension_resolution,
242242
kAllowedInEnvironment);
243243
AddOption("--no-deprecation",
244244
"silence deprecation warnings",

src/node_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class EnvironmentOptions : public Options {
8686
public:
8787
bool abort_on_uncaught_exception = false;
8888
bool experimental_modules = false;
89-
bool legacy_resolution = false;
89+
std::string esm_extension_resolution = "none";
9090
std::string module_type;
9191
std::string experimental_policy;
9292
bool experimental_repl_await = false;

0 commit comments

Comments
 (0)