Skip to content

Commit 864ecb0

Browse files
targosRafaelGSS
authored andcommitted
src: do not treat all paths ending with node_modules as such
Fixes: #51245 PR-URL: #51269 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
1 parent f4f781d commit 864ecb0

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/node_modules.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ void BindingData::GetPackageScopeConfig(
363363
return;
364364
}
365365

366-
std::string_view node_modules_package_path = "node_modules/package.json";
366+
std::string_view node_modules_package_path = "/node_modules/package.json";
367367
auto error_context = ErrorContext();
368368
error_context.is_esm = true;
369369

test/es-module/test-esm-resolve-type.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ try {
3838
* with the defaultResolver
3939
*/
4040
[
41+
[ '/es-modules/package-ends-node_modules/index.js', 'module' ],
4142
[ '/es-modules/package-type-module/index.js', 'module' ],
4243
[ '/es-modules/package-type-commonjs/index.js', 'commonjs' ],
4344
[ '/es-modules/package-without-type/index.js', 'commonjs' ],

test/fixtures/es-modules/package-ends-node_modules/index.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/es-modules/package-ends-node_modules/package.json

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)