Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esm: fix hint on invalid module specifier #51223

Merged
merged 7 commits into from
Dec 23, 2023
Prev Previous commit
fixup! fixup! fixup! esm: fix hint on invalid module specifier
  • Loading branch information
aduh95 authored Dec 23, 2023
commit 38f4580dbff46ce2919b16add54afb1798445fa5
4 changes: 2 additions & 2 deletions lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
@@ -942,8 +942,8 @@ function resolveAsCommonJS(specifier, parentURL) {
// module
const i = StringPrototypeIndexOf(specifier, '/');
const pkg = i === -1 ? specifier : StringPrototypeSlice(specifier, 0, i);
const needle = `node_modules${sep}${pkg}${sep}`;
const index = StringPrototypeIndexOf(found, needle);
const needle = `${sep}node_modules${sep}${pkg}${sep}`;
const index = StringPrototypeLastIndexOf(found, needle);
if (index !== -1) {
found = pkg + '/' + ArrayPrototypeJoin(
ArrayPrototypeMap(