Unverified Commit 7e375d00 authored by Sam Poder's avatar Sam Poder Committed by GitHub

[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.
parent b8cbf6d4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment