GoogleChrome / workbox

📦 Workbox: JavaScript libraries for Progressive Web Apps
https://developers.google.com/web/tools/workbox/
MIT License
12.36k stars 818 forks source link

Investigate alternative ES2015-friendly minifiers #523

Closed jeffposnick closed 7 years ago

jeffposnick commented 7 years ago

While we're currently using babili for our production builds, both https://github.com/Rich-Harris/butternut and https://www.npmjs.com/package/uglify-es might be viable options.

We should do a bit of a bake-off and see what the results are for our codebase.

jeffposnick commented 7 years ago

Rich Harris was good enough to publish https://github.com/rollup/rollup-plugin-butternut early.

Quick-and-dirty comparison:

I haven't looked at uglify-es yet, and I haven't confirmed that the prod bundles that Butternut is building don't have any subtle bugs, but that does look encouraging!

jeffposnick commented 7 years ago

I'm revisiting this, and bumped up against https://github.com/Rich-Harris/butternut/issues/170 when trying out butternut.

(Technically we could modify the code in question to work around the bug, as removing the async keyword would make butternut happy. async isn't needed there, because the arrow function it's applied to doesn't call await. But I don't feel great about making changes to our codebase to work around a minification bug.)

jeffposnick commented 7 years ago

And https://www.npmjs.com/package/uglify-es doesn't support async/await at all yet, so that's off the table.

gauntface commented 7 years ago

Is there anything else to do here? Given that you've explored and raised issues I think we just need to wait until a time that it's worth a new issue to re-explore.

jeffposnick commented 7 years ago

butternut resulted in bundles that were small enough that I think it's worth leaving this open, to remind us that moving to butternut would still be a Good Thing once the output passes our test suite.

gauntface commented 7 years ago

Could we not just reopen this once / if https://github.com/Rich-Harris/butternut/issues/170 is address?

jeffposnick commented 7 years ago

Okay.

anilanar commented 7 years ago

O made a PR for that bug.

kzc commented 7 years ago

uglify-es@3.0.20 supports async/await. File a bug report if there's any issue.

gauntface commented 7 years ago

I'm going to take this on. Will add it as a bit of infra testing so we can quickly run and compare sizes.

gauntface commented 7 years ago

V3 is using uglify-es with some pretty aggressive minifcation so I think this can be closed for now.

kzc commented 7 years ago

rollup-plugin-uglify-es appears to be unused and can be removed.

https://github.com/GoogleChrome/workbox/blob/a88bfc0cc5c2a87a5b1b7280e284a728728f09f1/package.json#L92