-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the compression is enabled, used variables are dropped. #1526
Comments
This doesn't seem to reproduce the problem because you forgot |
Thanks @liuxingbaoyu for pointing it out. Updated the original example. |
I managed this reproduction with less elements const testVarOne = 'Please preserve this';
const usedOnce = testVarOne
const usedTwice = testVarOne
class MyElement {
static {
// class refers to itself AND has side-effects.
sideEffect(this);
}
notDeletedReference = usedTwice;
} The class |
Bug report
As the title already says, when the compression is enabled, even some used variables get dropped. Sometimes it is also happens for imported modules when static blocks come into picture.
Version (complete output of
terser -V
or specific git commit)Terser REPL
Complete CLI command or
minify()
options usedNA
terser
inputterser
output or errorExpected result
The text was updated successfully, but these errors were encountered: