Skip to content

Tree-shaking removes Object.defineProperty side-effect when using chained assignment #6181

Closed

Description

@jtlehtinen

Rollup Version

4.53.2

Operating System (or Browser)

All

Node Version (if applicable)

No response

Link To Reproduction

https://rollupjs.org/repl/?version=4.53.2&shareable=eyJleGFtcGxlIjpudWxsLCJtb2R1bGVzIjpbeyJjb2RlIjoiY2xhc3MgQSB7XG5cdGNvbnN0cnVjdG9yKCkge1xuXHRcdGNvbnN0IGxvY2FsID0gKHRoaXMuYiA9IHt9KVxuXHRcdE9iamVjdC5kZWZpbmVQcm9wZXJ0eShsb2NhbCwgJ2MnLCB7IHZhbHVlOiA0MiB9KVxuXHR9XG59XG5cbmNvbnNvbGUubG9nKG5ldyBBKCkuYi5jKSIsImlzRW50cnkiOnRydWUsIm5hbWUiOiJtYWluLmpzIn1dLCJvcHRpb25zIjp7fX0=

Expected Behaviour

The local variable aliases a property this.b, hence mutation with Object.defineProperty(...) should not be tree shaked away.

Actual Behaviour

Side-effect is tree shaked from the build. See original issue vitejs/vite#21119.

Activity

  1. self-assigned this
    on Nov 16, 2025
  2. lukastaegert commented on Nov 16, 2025

    @lukastaegert
    Member

    Thanks for the issue! Fix at #6183

  3. github-actions commented on Nov 19, 2025

    @github-actions

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions