From 15070611386f92518f1b483c9f1486dfff434839 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Fri, 18 Aug 2017 15:44:16 +0200 Subject: [PATCH] Distinct spa mode to use generate directly --- bin/nuxt-build | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/bin/nuxt-build b/bin/nuxt-build index dc0a23fdee..1b4eac3aff 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -70,22 +70,23 @@ debug('Building...') const nuxt = new Nuxt(options) const builder = new Builder(nuxt) -builder.build() - .then(() => { - debug('Building done') - if (options.mode === 'spa') { - // Disable minify to get exact results of nuxt start - nuxt.options.generate.minify = false - // Generate on SPA mode - return new Generator(nuxt, builder).generate({ build: false, minify: false }).then(() => { - if (!nuxt.options.dev) { - // eslint-disable-next-line no-console - console.log(`✓ You can now directly upload ${nuxt.options.generate.dir}/ or start server using "nuxt start"`) - } - }) +if (options.mode !== 'spa') { + // Build for SSR app + builder.build() + .then(() => debug('Building done')) + .catch((err) => { + console.error(err) // eslint-disable-line no-console + process.exit(1) + }) +} else { + // Disable minify to get exact results of nuxt start + nuxt.options.generate.minify = true + // Generate on spa mode + new Generator(nuxt, builder).generate({ build: true }).then(() => { + if (!nuxt.options.dev) { + // eslint-disable-next-line no-console + console.log(`✓ You can now directly upload ${nuxt.options.generate.dir}/ or start server using "nuxt start"`) } }) - .catch((err) => { - console.error(err) // eslint-disable-line no-console - process.exit(1) - }) +} +