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

Rollup deletes code with side effects due to incorrect pure annotations #4282

Closed
evanw opened this issue Nov 24, 2021 · 1 comment · Fixed by #4955
Closed

Rollup deletes code with side effects due to incorrect pure annotations #4282

evanw opened this issue Nov 24, 2021 · 1 comment · Fixed by #4955

Comments

@evanw
Copy link

evanw commented Nov 24, 2021

Rollup Version

2.60.1

Operating System (or Browser)

Chrome 96

Node Version (if applicable)

No response

Link To Reproduction

https://rollupjs.org/repl/?version=2.60.1&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmNvbnN0JTIweCUyMCUzRCUyMG5ldyUyME1hcCglN0IlNUNuJTIwJTIwJTVCU3ltYm9sLml0ZXJhdG9yJTVEKCklMjAlN0IlNUNuJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJTVDbiUyMCUyMCUyMCUyMCUyMCUyMG5leHQoKSUyMCU3QiU1Q24lMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb25zb2xlLmxvZygnc2lkZSUyMGVmZmVjdCcpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCU3QiUyMGRvbmUlM0ElMjB0cnVlJTIwJTdEJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCU3RCU1Q24lMjAlMjAlMjAlMjAlN0QlNUNuJTIwJTIwJTdEJTVDbiU3RCklNUNuJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==

Expected Behaviour

Here's the input code from the link above:

const x = new Map({
  [Symbol.iterator]() {
    return {
      next() {
        console.log('side effect')
        return { done: true }
      }
    }
  }
})

The code generated by Rollup should print side effect.

Actual Behaviour

The code generated by Rollup is incorrectly empty, and so prints nothing.

The context for this is that someone wanted esbuild to do what Rollup does here: evanw/esbuild#1791. However, what Rollup does here seems to be incorrect, so I reported a bug here instead. I don't need this to be fixed myself so feel free to do what you want with this bug report.

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4955 as part of rollup@3.21.2. 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
Development

Successfully merging a pull request may close this issue.

3 participants