next.js
7e375d00 - [turbopack] Treat local `const` assignments as side-effect free (#94294)

Commit
3 days ago
[turbopack] Treat local `const` assignments as side-effect free (#94294) This is a follow-up to this comment: https://github.com/vercel/next.js/blob/89562628d27b672352d212ecd8c6941873e83222/turbopack/crates/turbopack-ecmascript/src/analyzer/side_effects.rs#L22 I wouldn't consider it a comprehensive tracker of local variables. However, it's a start. Only `const`s are tracked at the moment. This is because with `let`s you can do things like: ```javascript let x = { a: "b" }; x = globalThis; x.a = "b" // side effect! ``` I do think this is a helpful improvement, though as it handles the common pattern that was mentioned in the comment.
Author
Parents
Loading