Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.

Conversation

@shortdiv
Copy link
Contributor

@shortdiv shortdiv commented Sep 25, 2020

Which problem is this pull request solving?
Addresses the discussion in #73 to minify es bundles.

List other issues or pull requests related to this problem
#76

Checklist

  • The status checks are successful (continuous integration). Those can be seen below.

@shortdiv shortdiv added the enhancement New feature or request label Sep 25, 2020
@shortdiv shortdiv requested a review from ehmicky September 25, 2020 18:52
@shortdiv shortdiv added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Sep 25, 2020
Copy link
Contributor

@ehmicky ehmicky left a comment

Choose a reason for hiding this comment

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

Amazing!
🎉

@ehmicky
Copy link
Contributor

ehmicky commented Sep 25, 2020

I have tried locally.

The integration-test big fixture goes from 556727 to 122,656 bytes (78% reduction).

The config-dir very small fixture goes from 245 to 122 bytes (50% reduction).

Before this PR:

(function(){'use strict';function onRequest() {}var funcc3499c2729730a7f807efb8676a92dcb6f8a3f8f=/*#__PURE__*/Object.freeze({__proto__:null,onRequest: onRequest});netlifyRegistry.set("example", funcc3499c2729730a7f807efb8676a92dcb6f8a3f8f);}());

After this PR:

!function(){"use strict";var e=Object.freeze({__proto__:null,onRequest:function(){}});netlifyRegistry.set("example",e)}();

@ehmicky
Copy link
Contributor

ehmicky commented Sep 25, 2020

Note: this reduces the func{randomID} to single letter variables. I have been wondering whether this would reverse the benefits of #66 (consistent bundle filenames).

However, this is not the case. The minified bundle content is the same when the source code does not change, and is different when the source code changes. Since the bundle filename is a hash of the bundle content, this should work.

We could optimize though by not generating that random ID anymore though, and only using an incrementing integers, since it does not seem to be useful anymore?

Copy link
Contributor

@mraerino mraerino left a comment

Choose a reason for hiding this comment

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

great!

@shortdiv shortdiv merged commit ca33b32 into master Sep 28, 2020
@shortdiv shortdiv deleted the terser branch September 28, 2020 14:53
@ehmicky ehmicky mentioned this pull request Sep 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request type: feature code contributing to the implementation of a feature and/or user facing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants