DTStack/ko

babel-import-plugin

Closed this issue · 1 comments

check if babel-import-plugin is suit for the newest babel & antd

Webpack 4 引入了 Pure Module 机制,相当于可以自动实现 import 'foo' 到 import 'foo/lib/bar' 的转换,不需要每个 package 自行定义规则了。。但为啥我们的项目几乎没有享受到这个功能?因为babel加了副作用代码或者转换到es5代码导致 tree-shaking失效了,tree-shaking触发条件为:esm模式且无副作用。总之webpack本身已经支持全依赖按需加载了。

详情点此