编译

tree-shaking

注释/#PURE/
babel自动添加
https://github.com/babel/babel/issues/5632

webpack实现的tree-shaking
https://medium.com/webpack/better-tree-shaking-with-deep-scope-analysis-a0b788c0ce77
中文版本:https://diverse.space/2018/05/better-tree-shaking-with-scope-analysis

image.png
because of the heavy curry usage. It is like that because bundlers/minifiers cannot know for sure that the call to curry is pure and wont cause any side-effects - they cannot be sure that it is safe to remove that call, even if its result stays unused.
curry化的内容,导致副作用无法被编译器识别,所以需要使用类似上方的方式,来标记一些确定没有副作用,可以被删除的代码。packa.json中有 side-effects 标记,可以用于标记自己的库是否有副作用操作。
image.png