Skip to content

Commit

Permalink
fix(cli): enable server for build when spa pages should be generated (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aldarund authored and pi0 committed Oct 8, 2019
1 parent 2b1366b commit 136777d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion distributions/nuxt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ It's as simple as that!

Or you can start by using one of our starter templates:

- [starter](https://github.com/nuxt-community/starter-template): Basic Nuxt.js project template
- [express](https://github.com/nuxt-community/express-template): Nuxt.js + Express
- [koa](https://github.com/nuxt-community/koa-template): Nuxt.js + Koa
- [adonuxt](https://github.com/nuxt-community/adonuxt-template): Nuxt.js + AdonisJS
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
},
async run (cmd) {
const config = await cmd.getNuxtConfig({ dev: false, server: false, _build: true })
config.server = config.mode === 'spa' && cmd.argv.generate !== false
const nuxt = await cmd.getNuxt(config)

if (cmd.argv.lock) {
Expand All @@ -72,15 +73,14 @@ export default {
}))
}

if (nuxt.options.mode !== 'spa' || cmd.argv.generate === false) {
if (nuxt.options.mode === 'spa' && cmd.argv.generate !== false) {
// Build + Generate for static deployment
const generator = await cmd.getGenerator(nuxt)
await generator.generate({ build: true })
} else {
// Build only
const builder = await cmd.getBuilder(nuxt)
await builder.build()
return
}

// Build + Generate for static deployment
const generator = await cmd.getGenerator(nuxt)
await generator.generate({ build: true })
}
}

0 comments on commit 136777d

Please sign in to comment.