fix constructor order logic

This commit is contained in:
Pooya Parsa 2017-06-14 00:29:26 +04:30
parent 277aa7e6fa
commit 5ba7d593aa

View File

@ -31,6 +31,11 @@ export default class Nuxt extends Tapable {
// Apply defaults // Apply defaults
this.options = _.defaultsDeep(options, Nuxt.Defaults) this.options = _.defaultsDeep(options, Nuxt.Defaults)
// Resolve dirs
this.options.rootDir = (typeof options.rootDir === 'string' && options.rootDir ? options.rootDir : process.cwd())
this.options.srcDir = (typeof options.srcDir === 'string' && options.srcDir ? resolve(options.rootDir, options.srcDir) : this.options.rootDir)
this.options.buildDir = join(this.options.rootDir, options.buildDir)
// If store defined, update store options to true // If store defined, update store options to true
if (fs.existsSync(join(this.options.srcDir, 'store'))) { if (fs.existsSync(join(this.options.srcDir, 'store'))) {
this.options.store = true this.options.store = true
@ -42,11 +47,6 @@ export default class Nuxt extends Tapable {
this.options.appTemplatePath = join(this.options.srcDir, 'app.html') this.options.appTemplatePath = join(this.options.srcDir, 'app.html')
} }
// Resolve dirs
this.options.rootDir = (typeof options.rootDir === 'string' && options.rootDir ? options.rootDir : process.cwd())
this.options.srcDir = (typeof options.srcDir === 'string' && options.srcDir ? resolve(options.rootDir, options.srcDir) : this.options.rootDir)
this.options.buildDir = join(this.options.rootDir, options.buildDir)
// Create instance of core components // Create instance of core components
this.moduleContainer = new Nuxt.ModuleContainer(this) this.moduleContainer = new Nuxt.ModuleContainer(this)
this.builder = new Nuxt.Builder(this) this.builder = new Nuxt.Builder(this)