// input.js
// cargo run -p swc_ecma_minifier --example compress input.js
function renderShape () {
var i;
var len = this.animatedContents.length;
var animatedContent;
for (i = 0; i < len; i += 1) {
animatedContent = this.animatedContents[i];
if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {
animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);
}
}
}
renderShape();
Config
{}
Playground link (or link to the minimal reproduction)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
swc_ecma_minifier produces bad code when optimizing lottie-web with default config.
i've tested with the example "compress" and found that seems https://github.com/swc-project/swc/commit/a69f172aacb29caafef2c2af0659faf1b9154f2c introduced the issue.
Input code
https://github.com/airbnb/lottie-web/blob/63a39aeb27b8c13726ce9fcf850d9351b14be3e6/build/player/lottie.js#L10380-L10392
Config
Playground link (or link to the minimal reproduction)
https://github.com/swc-project/swc/blob/main/crates/swc_ecma_minifier/examples/compress.rs
SWC Info output
No response
Expected behavior
https://github.com/swc-project/swc/commit/3b845c33b34aaa5de3d304efc2c8bf8f276c9390
Actual behavior
https://github.com/swc-project/swc/commit/a69f172aacb29caafef2c2af0659faf1b9154f2c
Version
0.189.84
Additional context
related: https://github.com/web-infra-dev/rspack/issues/5656