Closed Code-Crash closed 1 year ago
This is an intentional effect of Terser's pure_getters
compression option:
pure_getters
(default:"strict"
) -- If you passtrue
for this, Terser will assume that object property access (e.g.foo.bar
orfoo["bar"]
) doesn't have any side effects. Specify"strict"
to treat foo.bar as side-effect-free only whenfoo
is certain to not throw, i.e. notnull
orundefined
.
Is there any particular reason you're relying on side effects (throwing) rather than just doing the following?
passEmitsToParent = window.parent.document ? false : true;
Yes @rschristian, I was relying on the catch block if I'm not able to access window.parent.document
, however as you said adding if statement
or ternary operator
, it's working.
so if it's expected behavior, then we are good.
Thanks for clarification.
In one of my builds, when I'm using the compress flag, it's causing the issue which is trimming the value from
window.parent.document
towindow
only, which is causing a failure in expected behavior.Please see the attached images for reference.
Below this image, we can see
window.parent.document
getting changed towindow
only, please see line number 3835 in the first image and in the second 2259.Please see the
window