diff --git a/src/bin/build.ts b/src/bin/build.ts index c14834ebda..36811ff74d 100755 --- a/src/bin/build.ts +++ b/src/bin/build.ts @@ -22,10 +22,15 @@ export const build = (): void => { webpack(webpackProdConfig, (err, stats) => { // Stats Object if (err || stats.hasErrors()) { // Handle errors here - console.error(stats.toString({ - chunks: false, - colors: true, - })); + + if (stats) { + console.error(stats.toString({ + chunks: false, + colors: true, + })); + } else { + console.error(err.message); + } } }); } catch (err) { diff --git a/src/webpack/getProdConfig.ts b/src/webpack/getProdConfig.ts index 8ad3d85910..de0abffc8c 100644 --- a/src/webpack/getProdConfig.ts +++ b/src/webpack/getProdConfig.ts @@ -19,7 +19,6 @@ export default (payloadConfig: Config): Configuration => { chunkFilename: '[name].[chunkhash].js', }, mode: 'production', - devtool: 'none', stats: 'errors-only', optimization: { minimizer: [new TerserJSPlugin({}), new CssMinimizerPlugin()],