Skip to content

Commit

Permalink
src: do not treat all paths ending with node_modules as such
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
targos authored and RafaelGSS committed Jan 2, 2024
1 parent f4f781d commit 864ecb0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_modules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ void BindingData::GetPackageScopeConfig(
return;
}

std::string_view node_modules_package_path = "node_modules/package.json";
std::string_view node_modules_package_path = "/node_modules/package.json";
auto error_context = ErrorContext();
error_context.is_esm = true;

Expand Down
1 change: 1 addition & 0 deletions test/es-module/test-esm-resolve-type.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ try {
* with the defaultResolver
*/
[
[ '/es-modules/package-ends-node_modules/index.js', 'module' ],
[ '/es-modules/package-type-module/index.js', 'module' ],
[ '/es-modules/package-type-commonjs/index.js', 'commonjs' ],
[ '/es-modules/package-without-type/index.js', 'commonjs' ],
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/es-modules/package-ends-node_modules/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 864ecb0

Please sign in to comment.