Skip to content

Commit 941d200

Browse files
committed
build: exit if build process produces an error
1 parent 85309f5 commit 941d200

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

build/build.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ build([
7373
format: 'esm',
7474
env: 'production'
7575
}
76-
].map(genConfig))
76+
].map(genConfig)).catch(error => {
77+
process.exit(1)
78+
})
7779

7880
function genConfig (opts) {
7981
const config = {
@@ -113,15 +115,18 @@ function build (builds) {
113115
let built = 0
114116
const total = builds.length
115117
const next = () => {
116-
buildEntry(builds[built]).then(() => {
118+
return buildEntry(builds[built]).then(() => {
117119
built++
118120
if (built < total) {
119-
next()
121+
return next()
120122
}
121-
}).catch(logError)
123+
}).catch(error => {
124+
logError(error)
125+
throw error
126+
})
122127
}
123128

124-
next()
129+
return next()
125130
}
126131

127132
function buildEntry ({ input, output }) {

0 commit comments

Comments
 (0)