From cc18907ec45c4b6f47a1875d034e5e40a1437200 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 5ea435ceaf36ad..037d872e1d4fa1 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, @@ -1227,8 +1228,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) {