fix(cli): handle error in full static mode with --fail-on-error (#7948)

This commit is contained in:
SHO-ZY 2020-08-26 04:38:12 +09:00 committed by GitHub
parent 51b037fea6
commit e0af2ed679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,11 @@ export async function generate (cmd) {
const generator = await cmd.getGenerator(nuxt)
await nuxt.server.listen(0)
await generator.generate({ build: false })
const { errors } = await generator.generate({ build: false })
await nuxt.close()
if (cmd.argv['fail-on-error'] && errors.length > 0) {
throw new Error('Error generating pages, exiting with non-zero code')
}
}
export async function ensureBuild (cmd) {