From d3ef1630048197ff40048deb9c78c69851e44cb9 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 23 Dec 2020 11:43:55 +0100 Subject: [PATCH] _fix(pnp): resolve module dependencies --- packages/core/src/module.js | 2 ++ packages/webpack/src/config/base.js | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/core/src/module.js b/packages/core/src/module.js index 466db6af5c..6a43e980cb 100644 --- a/packages/core/src/module.js +++ b/packages/core/src/module.js @@ -157,6 +157,8 @@ export default class ModuleContainer { if (!handler) { try { handler = this.nuxt.resolver.requireModule(src, { paths }) + // pnp support + try { (global.__NUXT_PATHS__ || []).push(this.nuxt.resolver.resolvePath(src, { paths })) } catch (_err) {} } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') { throw error diff --git a/packages/webpack/src/config/base.js b/packages/webpack/src/config/base.js index 2d1175c47a..c119db7aa1 100644 --- a/packages/webpack/src/config/base.js +++ b/packages/webpack/src/config/base.js @@ -228,6 +228,7 @@ export default class WebpackBaseConfig { const resolvePath = [ this.buildContext.options.rootDir, __dirname, + ...(global.__NUXT_PATHS__ || []), resolveModule('@nuxt/vue-app'), resolveModule('@nuxt/babel-preset-app') ]