diff --git a/bin/nuxt-build b/bin/nuxt-build index 64a803bcc5..2bf9aac0d9 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -29,6 +29,7 @@ if (argv.help) { --analyze, -a Launch webpack-bundle-analyzer to optimize your bundles. --spa Launch in SPA mode --universal Launch in Universal mode (default) + --no-generate Don't generate static version for SPA mode (useful for nuxt start) --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) --help, -h Displays this message `) @@ -63,15 +64,16 @@ const close = () => { process.exit(0) } -if (options.mode !== 'spa') { - // -- Build only -- +if (options.mode !== 'spa' || argv.generate === false) { + // Build only builder .build() .then(() => close()) .catch(error => consola.fatal(error)) } else { - // Generate dist for SPA static deployment - new Generator(nuxt, builder).generate({ build: true }).then(() => { - close() - }) + // Build + Generate for static deployment + new Generator(nuxt, builder) + .generate({ build: true }) + .then(() => close()) + .catch(error => consola.fatal(error)) }