webcrack icon indicating copy to clipboard operation
webcrack copied to clipboard

transform let declaration with 0 constantViolations to const

Open Le0Developer opened this issue 7 months ago • 2 comments
trafficstars

minifiers prefer let over const because it's shorter, so lets recover consts if they're never violated

cant be done with var due to the different scoping

Le0Developer avatar Mar 30 '25 08:03 Le0Developer

Is there any minifier that converts const to let? Also see https://github.com/terser/terser/issues/172 for caveats, would have to specify if the code is running at the top-level or skip it

j4k0xb avatar Mar 30 '25 17:03 j4k0xb

Is there any minifier that converts const to let?

SWC (but not top-level)

Le0Developer avatar Mar 30 '25 18:03 Le0Developer