Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): initialize server for build when there pages should be gene… #6525

Merged
merged 2 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 })
}
}