diff --git a/bin/nuxt-build b/bin/nuxt-build index d3c1ffe8e1..147bf85462 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -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() }) }