From ade5cea98518854348345e2003402434d703b4ca Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Wed, 21 Apr 2021 17:02:53 -0400 Subject: [PATCH] Use concat for paths --- dist/index.js | 4 +++- src/wrap-require.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index dfe5366..10de55d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2467,7 +2467,9 @@ const wrapRequire = new Proxy(require, { return target.apply(thisArg, [moduleID]); } catch (err) { - return target.resolve(moduleID, { paths: [...module.paths, process.cwd()] }); + return target.resolve(moduleID, { + paths: module.paths.concat(process.cwd()) + }); } }, get: (target, prop, receiver) => { diff --git a/src/wrap-require.ts b/src/wrap-require.ts index b803069..e38d9d9 100644 --- a/src/wrap-require.ts +++ b/src/wrap-require.ts @@ -10,7 +10,9 @@ export const wrapRequire = new Proxy(__non_webpack_require__, { try { return target.apply(thisArg, [moduleID]) } catch (err) { - return target.resolve(moduleID, {paths: [...module.paths, process.cwd()]}) + return target.resolve(moduleID, { + paths: module.paths.concat(process.cwd()) + }) } },