mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix(cli): enable server for build when spa pages should be generated (#6525)
This commit is contained in:
parent
2b1366b965
commit
136777de1d
@ -99,7 +99,6 @@ It's as simple as that!
|
|||||||
|
|
||||||
Or you can start by using one of our starter templates:
|
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
|
- [express](https://github.com/nuxt-community/express-template): Nuxt.js + Express
|
||||||
- [koa](https://github.com/nuxt-community/koa-template): Nuxt.js + Koa
|
- [koa](https://github.com/nuxt-community/koa-template): Nuxt.js + Koa
|
||||||
- [adonuxt](https://github.com/nuxt-community/adonuxt-template): Nuxt.js + AdonisJS
|
- [adonuxt](https://github.com/nuxt-community/adonuxt-template): Nuxt.js + AdonisJS
|
||||||
|
@ -62,6 +62,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async run (cmd) {
|
async run (cmd) {
|
||||||
const config = await cmd.getNuxtConfig({ dev: false, server: false, _build: true })
|
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)
|
const nuxt = await cmd.getNuxt(config)
|
||||||
|
|
||||||
if (cmd.argv.lock) {
|
if (cmd.argv.lock) {
|
||||||
@ -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
|
// Build only
|
||||||
const builder = await cmd.getBuilder(nuxt)
|
const builder = await cmd.getBuilder(nuxt)
|
||||||
await builder.build()
|
await builder.build()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build + Generate for static deployment
|
|
||||||
const generator = await cmd.getGenerator(nuxt)
|
|
||||||
await generator.generate({ build: true })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user