optim: add assumptions
to Babel config, mirroring previous config
#79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Optimize output by adding
assumptions
to the Babel config, which mirrors the previous build system's config that uses Babel 7.Details
previously used Babel 6's preset-stage-2, which, in Babel 7, is the equivalent of turning on
loose
inproposal-class-properties
:https://github.com/babel/babel/tree/v7.5.5/packages/babel-preset-stage-2
top-level
assumptions
replace the oldloose
configurations:https://github.com/babel/rfcs/blob/main/rfcs/0003-top-level-assumptions.md#assumptions-list
this makes the minified UMD size ~20% smaller, very close to the size it was previously w/ Babel 6
as a double-check measure, I compared the old package's minified UMD to see if it had the helpers in it
this was a bit hard to do as it was minified after all, but I was able to more-or-less correlate all the helpers with either error messages in the helper code (which can't be minified), or specific methods or properties that aren't normally touched (e.g.
enumerable
)this looks be a good bit closer to the old build's results, but should still be wary of possible legacy compat issues and note that in the release notes
compat-table
that happened during upgrading of the build system, which would change whatdefaults
means forbrowserslist
etcHistory
I knew the output was different (and larger) due to spec-compliancy changes, but somehow didn't think about adding
loose
etc as an optimization until I saw Babel'sassumptions
RFC. I thought I wrote about the output differences in #42 (review) , but I guess I didn't? Couldn't find it in a commit message either, but could've sworn I wrote it down somewhere...