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
Conditional function declaration hoisting dependends on the agent (chrome and firefox hoist the name, but the function is undefined, ie hoists nothing, safari hoists the whole function MDN)
In the same situation, terser seems to exclude function declaration from the flipped condition (the function is declared after the end of the flipped condition).
The text was updated successfully, but these errors were encountered:
swc_ecma_minifier:
- Don't change depth of function while negating if statements. (#2558)
swc_ecma_transforms_optimization:
- `dead_branch_remover`: Preserve `this`. (#2465, #2466)
swc:
- Make `toplevel` default to true if `module` is true. (#2254)
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.
On my projet, one of the dependencies is url-search-params-polyfill.
When i try to minify my projet, some minify optimisation breaks this dependency : REPL link
I belive swc tries to "flip" this condition : https://github.com/jerrybendy/url-search-params-polyfill/blob/c03102a7971c190284e2503805c4939e830c4ebc/index.js#L32-L34, without hoisting the function declaration
URLSearchParamsPolyfill
. This function stays in the scope of the "flipped" if block :Conditional function declaration hoisting dependends on the agent (chrome and firefox hoist the name, but the function is undefined, ie hoists nothing, safari hoists the whole function MDN)
In the same situation, terser seems to exclude function declaration from the flipped condition (the function is declared after the end of the flipped condition).
The text was updated successfully, but these errors were encountered: