_fix(pnp): resolve module dependencies

This commit is contained in:
Pooya Parsa 2020-12-23 11:43:55 +01:00
parent 5bd4fe08c6
commit d3ef163004
2 changed files with 3 additions and 0 deletions

View File

@ -157,6 +157,8 @@ export default class ModuleContainer {
if (!handler) { if (!handler) {
try { try {
handler = this.nuxt.resolver.requireModule(src, { paths }) handler = this.nuxt.resolver.requireModule(src, { paths })
// pnp support
try { (global.__NUXT_PATHS__ || []).push(this.nuxt.resolver.resolvePath(src, { paths })) } catch (_err) {}
} catch (error) { } catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') { if (error.code !== 'MODULE_NOT_FOUND') {
throw error throw error

View File

@ -228,6 +228,7 @@ export default class WebpackBaseConfig {
const resolvePath = [ const resolvePath = [
this.buildContext.options.rootDir, this.buildContext.options.rootDir,
__dirname, __dirname,
...(global.__NUXT_PATHS__ || []),
resolveModule('@nuxt/vue-app'), resolveModule('@nuxt/vue-app'),
resolveModule('@nuxt/babel-preset-app') resolveModule('@nuxt/babel-preset-app')
] ]