Skip to content

Commit 36f961e

Browse files
authored
fix(cli-service): process the webpack failed hook in the serve command (#5542)
fixes #4891
1 parent fa871b0 commit 36f961e

File tree

1 file changed

+7
-0
lines changed
  • packages/@vue/cli-service/lib/commands

1 file changed

+7
-0
lines changed

packages/@vue/cli-service/lib/commands/serve.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const {
22
info,
3+
error,
34
hasProjectYarn,
45
hasProjectPnpm,
56
openBrowser,
@@ -161,6 +162,12 @@ module.exports = (api, options) => {
161162
// create compiler
162163
const compiler = webpack(webpackConfig)
163164

165+
// handle compiler error
166+
compiler.hooks.failed.tap('vue-cli-service serve', msg => {
167+
error(msg)
168+
process.exit(1)
169+
})
170+
164171
// create server
165172
const server = new WebpackDevServer(compiler, Object.assign({
166173
logLevel: 'silent',

0 commit comments

Comments
 (0)