Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree shake doesn't respect for...of literal of array #4901

Closed
TooBug opened this issue Mar 13, 2023 · 1 comment · Fixed by #4949
Closed

tree shake doesn't respect for...of literal of array #4901

TooBug opened this issue Mar 13, 2023 · 1 comment · Fixed by #4949

Comments

@TooBug
Copy link

TooBug commented Mar 13, 2023

Rollup Version

2.69.0

Operating System (or Browser)

Chrome

Node Version (if applicable)

No response

Link To Reproduction

https://rollupjs.org/repl/?version=2.69.0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyY29uc3QlMjBmb28lMjAlM0QlMjAlNUIlN0IlMjB2YWx1ZSUzQSUyMDElMjAlN0QlNUQlNUNuJTVDbmZvciUyMChjb25zdCUyMGl0ZW0lMjBvZiUyMGZvbyklMjAlN0IlNUNuJTIwJTIwaXRlbS52YWx1ZSUyMCUzRCUyMDAlNUNuJTdEJTVDbiU1Q25pZiUyMChmb28lNUIwJTVELnZhbHVlJTIwJTNEJTNEJTNEJTIwMCklMjAlN0IlNUNuJTIwJTIwY29uc29sZS5sb2coJ0hlbGxvJyklNUNuJTdEJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlN0QlMkMlMjJ0cmVlc2hha2UlMjIlM0F0cnVlJTdEJTdE

Expected Behaviour

const foo = [{ value: 1 }];

for (const item of foo) {
  item.value = 0;
}

if (foo[0].value === 0) {
  console.log('Hello');
}

Actual Behaviour

const foo = [{ value: 1 }];

for (const item of foo) {
  item.value = 0;
}
@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4949 as part of rollup@3.20.7. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants