You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Provide a stub for field preserver to make things work without full// compilation.if(!COMPILED||goog.DEBUG){globalThis.$J2CL_PRESERVE$=function(/** ...* */e){};}
Which will clearly be kept, though it shouldn't be, according to the comment.
To ensure this is removed, we want goog.DEBUG to be set to false. This is probably a good idea generally, but it might also be possible to remove the goog.DEBUG check and just used COMPILED.
The text was updated successfully, but these errors were encountered:
Code compiled by j2cl-maven-plugin gets an extra method defined on globalThis, even when everything else is compiled out:
J2CL's jre.js sets up a special function to prevent certain optimizations: https://github.com/Vertispan/j2cl/blob/aa5f8c2eec98b5314071f96572a9002599754279/jre/java/java/lang/jre.js#L55-L59
See also https://github.com/Vertispan/j2cl/blob/aa5f8c2eec98b5314071f96572a9002599754279/jre/java/java/lang/externs.js#L22-L25 for the externs that define this method as being external.
Closure-compiler specially looks for this value, guards it to ensure only j2cl code can call it:
https://github.com/Vertispan/closure-compiler/blob/ebf577bd36a6f24a27b71e4498371066a831270d/src/com/google/javascript/jscomp/CheckSideEffects.java#L53-L56
In j2cl-maven-plugin, this code is eventually compiled to
Then, defines are inlined:
Which will clearly be kept, though it shouldn't be, according to the comment.
To ensure this is removed, we want
goog.DEBUG
to be set to false. This is probably a good idea generally, but it might also be possible to remove the goog.DEBUG check and just used COMPILED.The text was updated successfully, but these errors were encountered: