Closed STLMikey closed 3 years ago
Should probably be fixable by setting some option (I think --keep-fnames
in terser) in the minifier to prevent such destructive minifaction but I'm pretty sure we can fix this with your suggestion too.
Edit: it seems not that simple, some existing test cases do not pass instanceof BigInteger
for some reason.
When building for production with Webpack, the Uglification process breaks a few checks within cidr-tools resulting in some unexpected behavior.
Specifically:
if (number.constructor.name !== "BigInteger")
if (a.constructor.name !== "BigInteger")
if (b.constructor.name !== "BigInteger")
When uglified, the name of the constructor gets uglified along with the reference, and no longer is equivalent to the string 'BigInteger'.
Changing these checks to
number instanceof BigInteger
would likely achieve the same thing, although I'm not certain enough without BigInteger-esque tests to make a PR affecting others too.