Closed agilgur5 closed 2 years ago
Merging #79 (09d8d60) into main (b14060c) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## main #79 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 75 75
Branches 9 9
=========================================
Hits 75 75
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b14060c...09d8d60. Read the comment docs.
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-2top-level
assumptions
replace the oldloose
configurations: https://github.com/babel/rfcs/blob/main/rfcs/0003-top-level-assumptions.md#assumptions-listthis 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
)prev minified UMD: https://unpkg.com/react-signature-canvas@1.0.5/build/index.js
Babel helper code: https://github.com/babel/babel/blob/a24c1d047e6db77c32d9505c6876897b4c3689d2/packages/babel-helpers/src/helpers.ts#L207
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
in particular, the implicit update to
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 https://github.com/agilgur5/react-signature-canvas/pull/42#pullrequestreview-947783313 , but I guess I didn't? Couldn't find it in a commit message either, but could've sworn I wrote it down somewhere...