Merge pull request #12957 from strapi/fix/build-error-swallow

Build: Prevent output from swallowing webpack errors
This commit is contained in:
cyril lopez 2022-03-25 18:55:59 +01:00 committed by GitHub
commit 750d66a3b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
const path = require('path');
const webpack = require('webpack');
const { isObject } = require('lodash');
const webpackConfig = require('../webpack.config');
const {
getCorePluginsPath,
@ -58,7 +59,20 @@ const buildAdmin = async () => {
if (messages.errors.length > 1) {
messages.errors.length = 1;
}
return reject(new Error(messages.errors.join('\n\n')));
return reject(
new Error(
messages.errors.reduce((acc, error) => {
if (isObject(error)) {
acc += error.message;
} else {
acc += error.join('\n\n');
}
return acc;
}, '')
)
);
}
return resolve({