Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit production build if any errors are in build stats #859

Merged
merged 2 commits into from
Oct 7, 2016

Conversation

pdillon
Copy link
Contributor

@pdillon pdillon commented Oct 6, 2016

Until webpack/webpack#2390 is addressed and all errors trigger the --bail switch, would be helpful to manually surface them from the production build stats passed in the callback.

Sample output

> react-scripts build

Creating an optimized production build...
Error(s) occurred during the production build:
static/js/main.9a6b731a.js from UglifyJs
SyntaxError: Unexpected token: name .....

@@ -128,6 +128,13 @@ function build(previousSizeMap) {
process.exit(1);
}

// Webpack may swallow uglify errors even with bail:true
if (stats.compilation.errors.length) {
console.error(chalk.red('Error(s) occurred during the production build:'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be the same message that we use for failed compilation in start.js? And would be nice to fix it up for the other (different) message in this file so they are all consistent.

@gaearon gaearon added this to the 0.7.0 milestone Oct 7, 2016
@gaearon gaearon merged commit c6428ea into facebook:master Oct 7, 2016
@gaearon
Copy link
Contributor

gaearon commented Oct 7, 2016

Thanks!

@pdillon pdillon deleted the webpack-bail-fix branch October 12, 2016 03:24
feiqitian pushed a commit to feiqitian/create-react-app that referenced this pull request Oct 25, 2016
* Exit on any errors passed in build stats

* Match console error output in start.js
jarlef pushed a commit to jarlef/create-react-app that referenced this pull request Nov 28, 2016
* Exit on any errors passed in build stats

* Match console error output in start.js
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants