mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(cli): handle build error and exit with code(1)
This commit is contained in:
parent
7eecc84f4d
commit
0bbbddecba
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import { resolve } from 'upath'
|
import { resolve } from 'upath'
|
||||||
import { requireModule } from '../utils/cjs'
|
import { requireModule } from '../utils/cjs'
|
||||||
|
import { error } from '../utils/log'
|
||||||
|
|
||||||
export async function invoke (args) {
|
export async function invoke (args) {
|
||||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||||
@ -9,6 +10,12 @@ export async function invoke (args) {
|
|||||||
const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir)
|
const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir)
|
||||||
|
|
||||||
const nuxt = await loadNuxt({ rootDir })
|
const nuxt = await loadNuxt({ rootDir })
|
||||||
|
|
||||||
|
nuxt.hook('error', (err) => {
|
||||||
|
error('Nuxt Build Error:', err)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
|
|
||||||
await buildNuxt(nuxt)
|
await buildNuxt(nuxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user