mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
module: fix unintended mutation
Refs: https://github.com/nodejs/node/pull/46061#issuecomment-1372246648 PR-URL: https://github.com/nodejs/node/pull/46108 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
This commit is contained in:
1 parent
021f72618c
commit
693b6fbeac
2 files changed
+10
-5
No files matched your search
@@ -29,6 +29,7 @@ const {
|
||||
ArrayPrototypeJoin,
|
||||
ArrayPrototypeMap,
|
||||
ArrayPrototypePush,
|
||||
ArrayPrototypePushApply,
|
||||
ArrayPrototypeSlice,
|
||||
ArrayPrototypeSplice,
|
||||
ArrayPrototypeUnshift,
|
||||
@@ -668,12 +669,11 @@ Module._findPath = function(request, paths, isMain) {
|
||||
return filename;
|
||||
}
|
||||
|
||||
if (exts === undefined) {
|
||||
exts = [''];
|
||||
} else {
|
||||
ArrayPrototypeUnshift(exts, '');
|
||||
const extensions = [''];
|
||||
if (exts !== undefined) {
|
||||
ArrayPrototypePushApply(extensions, exts);
|
||||
}
|
||||
reportModuleNotFoundToWatchMode(basePath, exts);
|
||||
reportModuleNotFoundToWatchMode(basePath, extensions);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Vendored
+5
@@ -98,3 +98,8 @@ assert.strictEqual(
|
||||
require.resolve('./printA.js', {}),
|
||||
require.resolve('./printA.js')
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
require.resolve('no_index/'),
|
||||
path.join(__dirname, 'node_modules', 'no_index', 'lib', 'index.js'),
|
||||
)
|
||||
Reference in new issue
Block a user