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

Fix FileSizeReporter for multi build Webpack setups #3514

Merged
merged 1 commit into from
Jan 9, 2018

Conversation

iiska
Copy link
Contributor

@iiska iiska commented Nov 28, 2017

FileSizeReporter would fail if create-react-app project is ejected and webpack configuration is
modified to multi build setup. This could be reproduced with webpack configuration which returns array of configuration objects.

Real world use case for that kind of setup could be implementing localization with separate builds for each language.

In those situations webpackStats parameter would contain stats array
for each build. This fix will try to access stats and then fallback to using plaing webpackStats object.

If stats array is found it is mapped through and flattened. Assets are handled like before.

If create-react-app project is ejected and webpack configuration is
modified to multi build setup FileSizeReporter would fail.

In those situations `webpackStats` parameter would contain stats array
for each build. This fix will try to access stats and then falls back
to using plaing webpackStats object.
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@erykpiast
Copy link

Thank you for this one @iiska, I hope it'll be merged soon :)

@gaearon gaearon added this to the 1.0.18 milestone Jan 9, 2018
@gaearon gaearon merged commit d61a331 into facebook:master Jan 9, 2018
@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

OK, looks reasonable. Thanks.

@gaearon gaearon mentioned this pull request Jan 15, 2018
Pavek pushed a commit to Pavek/create-react-app that referenced this pull request Jul 10, 2018
If create-react-app project is ejected and webpack configuration is
modified to multi build setup FileSizeReporter would fail.

In those situations `webpackStats` parameter would contain stats array
for each build. This fix will try to access stats and then falls back
to using plaing webpackStats object.
@lock lock bot locked and limited conversation to collaborators Jan 20, 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.

4 participants