esm: modify resolution order for specifier flag · nodejs/node@94ac44f · GitHub
Skip to content

Commit 94ac44f

Browse files
MylesBorinstargos
authored andcommitted
esm: modify resolution order for specifier flag
Currently `--es-module-specifier-resolution=node` has an alternative resolution order than the default in common.js, this causes inconsistencies. As discussed in @nodejs/modules we want to preserve resolution order between implementations. PR-URL: #29974 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 5616f22 commit 94ac44f

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

lib/internal/modules/esm/default_resolve.js

Lines changed: 4 additions & 0 deletions

src/module_wrap.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ using v8::Undefined;
4848
using v8::Value;
4949

5050
static const char* const EXTENSIONS[] = {
51-
".mjs",
52-
".cjs",
5351
".js",
5452
".json",
55-
".node"
53+
".node",
54+
".mjs"
5655
};
5756

5857
ModuleWrap::ModuleWrap(Environment* env,

test/es-module/test-esm-specifiers.mjs

Lines changed: 3 additions & 3 deletions

test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)