resolve extra modules if nuxt linked (#2212)

This commit is contained in:
Dmitriy 2017-11-24 11:20:00 +03:00 committed by Pooya Parsa
parent fd42610862
commit 967a442d5e
2 changed files with 8 additions and 0 deletions

View File

@ -181,6 +181,7 @@ Options.defaults = {
debug: undefined, // Will be equal to dev if not provided
buildDir: '.nuxt',
cacheDir: '.cache',
nuxtDir: resolve(__dirname, '..'), // Relative to dist
nuxtAppDir: resolve(__dirname, '../lib/app/'), // Relative to dist
build: {
analyze: false,

View File

@ -19,6 +19,13 @@ export default class Nuxt {
// Paths for resolving requires from `rootDir`
this.nodeModulePaths = Module._nodeModulePaths(this.options.rootDir)
if (this.options.nuxtDir.indexOf(this.options.rootDir) !== 0) {
this.nodeModulePaths = [
...this.nodeModulePaths,
...Module._nodeModulePaths(this.options.nuxtDir)
]
}
this.initialized = false
this.errorHandler = this.errorHandler.bind(this)
// Hooks