option-t
option-t copied to clipboard
Add `@__NO_SIDE_EFFECTS__` or `@__PURE__` annotations
Motivation
This helps to provide more information to a minifier for code reduction.
Implementation
- Add
@__NO_SIDE_EFFECTS__
annotation for function definitions - Add
@__PURE__
annotation for callee site
Unresolved Questions
- We need to add them carefully.
- If we supply them, a minifier trusts their information for code reduction. This means that this effort would lead a bug. It might be hard to reproduce or detect because an user would run minifier only in a production/release build.
- Testing.
See also
- https://github.com/rollup/rollup/pull/5024
- https://github.com/evanw/esbuild/issues/3149
- https://github.com/swc-project/swc/issues/7525
- https://github.com/mishoo/UglifyJS/issues/5234