Skip to content

Commit

Permalink
feat: use process.exit(1) replace throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Feb 27, 2024
1 parent be5cd57 commit efe5e40
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/webpack/src/utils/promisify.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import * as webpack from 'ssr-webpack4'
import type { Stats, Configuration, Compiler } from 'webpack'

import { Stats, Configuration, Compiler } from 'webpack'
const errorEmitPlugin = function (compiler: Compiler) {
compiler.hooks.done.tapAsync('done', function (stats, callback) {
if (stats.compilation.errors.length > 0) {
const isDev = process.env.NODE_ENV !== 'production'
if (isDev) {
console.error(stats.compilation.errors)
} else {
throw new Error(stats.compilation.errors[0].stack)
console.error(stats.compilation.errors)
if (!isDev) {
process.exit(1)
}
}
callback()
Expand Down

0 comments on commit efe5e40

Please sign in to comment.