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 am developping library of components with rollup and I am using agadoo tool to check if it is tree shakable.
Maybe this question is off the topic, but when I use the below code the library is not tree shakable. And I don't understand why.
This is because agadoo can't know that the member expression React.PureComponent has no side effect.
Consider that React is an object. When you access a property of an object (in this case PureComponent) it might be backed by a ‘getter’ – a function that runs to get you the value.
constReact={getPureComponent(){// Perform some awful side effect.window.__PURE_COMPONENT_WAS_USED=true;return/* ... */;}}
Agadoo just throws up its hands, says ‘I can't possibly know that property access didn't result in a side effect,’ and does not tree-shake the code away.
I am developping library of components with rollup and I am using agadoo tool to check if it is tree shakable.
Maybe this question is off the topic, but when I use the below code the library is not tree shakable. And I don't understand why.
On the other hand, when I don't use the React Component, it stays tree shakable, so what's wrong with the React component?
The text was updated successfully, but these errors were encountered: