diff --git a/packages/core/src/resolver.js b/packages/core/src/resolver.js index b3c7ebcb70..78c83b5873 100644 --- a/packages/core/src/resolver.js +++ b/packages/core/src/resolver.js @@ -28,7 +28,7 @@ export default class Resolver { resolveModule (path, { paths } = {}) { try { return this._require.resolve(path, { - paths: [].concat(paths || [], this.options.modulesDir) + paths: [].concat(paths || [], this.options.modulesDir, global.__NUXT_PATHS__ || []) }) } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') { diff --git a/packages/utils/src/cjs.js b/packages/utils/src/cjs.js index 750030e353..491aae4113 100644 --- a/packages/utils/src/cjs.js +++ b/packages/utils/src/cjs.js @@ -68,11 +68,7 @@ export function resolveModule (id, paths) { paths = [paths] } return _require.resolve(id, { - paths: [ - process.cwd(), - ...(paths || []), - ...(global.__NUXT_PATHS__ || []) - ] + paths: [].concat(paths || [], global.__NUXT_PATHS__ || []) }) }