From 1aae57222067d9f32c21f312c2a96c3a8d6f1bc8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 21 Nov 2020 19:28:54 +0100 Subject: [PATCH] module: refactor to use more primordials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/36348 Reviewed-By: Michaƫl Zasso Reviewed-By: Anto Aravinth Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott --- lib/internal/modules/cjs/loader.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 55264c35e6f8a0..b9dbf794511528 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -31,6 +31,7 @@ const { ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSplice, + ArrayPrototypeUnshift, Boolean, Error, JSONParse, @@ -1204,8 +1205,8 @@ Module._initPaths = function() { let paths = [path.resolve(prefixDir, 'lib', 'node')]; if (homeDir) { - paths.unshift(path.resolve(homeDir, '.node_libraries')); - paths.unshift(path.resolve(homeDir, '.node_modules')); + ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries')); + ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_modules')); } if (nodePath) {