Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@jtlehtinen

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions