fix(nuxt-build): wait for use exit when running with --analyze flag

This commit is contained in:
Pooya Parsa 2018-01-14 14:04:45 +03:30
parent c4c63e0c66
commit c3bcda873c
1 changed files with 10 additions and 2 deletions

View File

@ -75,12 +75,20 @@ const builder = new Builder(nuxt)
// Setup hooks
nuxt.hook('error', (_err, from) => Utils.fatalError(_err, from))
// Close function
const close = () => {
if (options.build.analyze === true) {
return // Wait for user exit
}
process.exit(0)
}
if (options.mode !== 'spa') {
// -- Build for SSR app --
builder
.build()
.then(() => debug('Building done'))
.then(() => process.exit(0))
.then(() => close())
.catch(err => {
Utils.fatalError(err)
})
@ -110,6 +118,6 @@ if (options.mode !== 'spa') {
// Generate dist for SPA static deployment
new Generator(nuxt, builder).generate({ build: true }).then(() => {
process.exit(0)
close()
})
}