-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Use Closure Compiler for UMD/Node bundles instead of Uglify #10236
Use Closure Compiler for UMD/Node bundles instead of Uglify #10236
Conversation
@trueadm Do you want to set up a Jest project for flat bundles and figure out a way to opt in a few tests into it? I imagine it working the following way:
|
Seems to be something odd going on with Prettier, as it keeps failing on CI yet running Prettier locally results in no file changes. @vjeux is there something I'm missing? |
Did you run yarn locally? |
@gaearon Yes, it didn't fix the problems I was having :/ |
Can you separate Prettier related changes into another PR? I don't quite understand why they are related to this PR. Maybe separating will also make it easier to understand what went wrong with the branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to look into it but I need more details. What exactly is conflicting, what is the before/after...
In my experience, it's usually a problem where the two versions are not in sync.
@flarnie I'm really eager to get this PR landed for the next release (beta?). I'll do more manual tests tomorrow and locally test the UMD bundles but it kind of needs public support as the bundles (UMD/CJS) aren't used on FB www. What do you think? |
Thanks for tagging me @trueadm :) Here is my thought - if most folks in open source are waiting for the RC or final 16.0 release to try the latest React, then the UMD flat bundles have not been well tested by the community any way at this point. So they will need public support after each beta/RC release either way, regardless of whether we merge this. If we wait, we may end up fixing bugs that are present with Uglify and not with the GCC (Google Closure Compiler) and so we might as well merge this. I can try to keep an eye on issues - is there anything in particular that we know to be risky about this change? |
I think this is OK to merge. Most likely syntax errors in old browsers, I guess? It doesn't feel super likely that closure will introduce logic errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥅 ⚽💨
scripts/rollup/results.json
Outdated
@@ -171,6 +171,70 @@ | |||
"react-noop-renderer.development.js (NODE_DEV)": { | |||
"size": 286618, | |||
"gzip": 60007 | |||
}, | |||
"ReactHTMLString-dev.js (FB_DEV)": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What bundle is this? Not really important but I don't think we have it :-)
I'm curious... will it get larger again when people pass it through Uglify? Since normally people do it as a build step. It's still nice to have smaller official UMD bundles but seems like people can't take advantage of them unless they explicitly load them as a separate file we packaged. |
@gaearon That's a good point. I tried it locally and it doesn't seem to make the bundles any bigger for me – which is the good news! I'm merging this as per comments above. |
Can you be more specific? They don't get bigger than what?
|
@spicyj Refers to the compression of files JS |
@spicyj Sorry, I wasn't very clear. React: 6kb (GCC) and 6kb (GCC + Uglify) Hope that explains things better. |
Have you verified using them via Webpack+Uglify doesn’t make them worse? |
@gaearon I get 120kb for React+ReactDOM bundle using webpack in production mode. So it looks like we're all good here. |
This change introduces Google Closure Compiler (JS version) in the build pipeline instead of Uglify for the minifcation process for UMD/Node bundles. Locally, I'm seeing positive bundle size wins:
We need to thoroughly test these new builds before this can be merged however.