From 26a62596c01905685c41b1646b50677235dce1d4 Mon Sep 17 00:00:00 2001 From: "Xin Du (Clark)" Date: Wed, 17 Jul 2019 20:04:40 +0100 Subject: [PATCH] fix: throw error when building failed in quiet mode (#6075) --- packages/webpack/src/builder.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/webpack/src/builder.js b/packages/webpack/src/builder.js index 223e6e0f51..4ade5db780 100644 --- a/packages/webpack/src/builder.js +++ b/packages/webpack/src/builder.js @@ -146,12 +146,12 @@ export class WebpackBundler { const stats = await compiler.run() if (stats.hasErrors()) { + // non-quiet mode: errors will be printed by webpack itself + const error = new Error('Nuxt build error') if (options.build.quiet === true) { - return Promise.reject(stats.toString(options.build.stats)) + error.stack = stats.toString('errors-only') } - - // Actual error will be printed by webpack - throw new Error('Nuxt Build Error') + throw error } // Await for renderer to load resources (programmatic, tests and generate)