Files
Niklas MischkulnigandGitHub 55d2104a13 fix(es/minifier): Make const_to_let work in arrows again (#11062)
**Description:**

I was seeing this snapshot test failure when trying to upgrade swc in
Turbopack:
```js
--- expected
+++ actual
@@ -1,3 +1,3 @@
-module.exports=["index.js",(t,e,o)=>{let s="Hello";console.log("Hello, world!",3,s),console.log(s)}];
+module.exports=["index.js",(o,s,t)=>{const e="Hello";console.log("Hello, world!",3,e),console.log(e)}];
```

The problem was that `is_top_level` was true here, even though the code
is inside an arrow function:

https://github.com/swc-project/swc/blob/27931895f59135e11f83a4ddf1d311bdcde97321/crates/swc_ecma_minifier/src/compress/optimize/mod.rs#L2836

Probably caused by https://github.com/swc-project/swc/pull/11035
2025-09-06 11:20:23 +09:00
..