You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I saw there is a list for native pure function in rollup source code (src/ast/nodes/shared/pureFunctions.ts), it's useful for tree shake. Without that (and assumption of set/get did nothing side effect, native methods did not be overrided, etc), we can almost shake nothing, because every lib has it's initialization part which may use many native methods, and get/set many properties.
But there are some functions, not pure, but pure like. Pure functions should do nothing change to arguments, when pure-like functions (I don't know how to name them usually) do something change to arguments, but no side effect, so if the returned value of pure-like function is not used, it can also be considered to be shaked. Like: Object.assignObject.freeze...
Without this feature, so many external modules initialization part will leave...
@lukastaegert Hi! Sorry to trouble you again. Is this feature I mentioned possible and easy to implement? Or there could be a custom api for pure/pure-like functions? Thank you!
I saw there is a list for native pure function in rollup source code (
src/ast/nodes/shared/pureFunctions.ts
), it's useful for tree shake. Without that (and assumption of set/get did nothing side effect, native methods did not be overrided, etc), we can almost shake nothing, because every lib has it's initialization part which may use many native methods, and get/set many properties.But there are some functions, not pure, but pure like. Pure functions should do nothing change to arguments, when pure-like functions (I don't know how to name them usually) do something change to arguments, but no side effect, so if the returned value of pure-like function is not used, it can also be considered to be shaked. Like:
Object.assign
Object.freeze
...Without this feature, so many external modules initialization part will leave...
Feature Use Case
module.js:
input.js:
Feature Proposal
Output this:
Not:
The text was updated successfully, but these errors were encountered: