使用antd官方推荐babel-plugin-import的按需加载组件,在开发模式下居然有1MB,好像所有组件都加载进去了
.babelrc配置如下:
不管是哪种引入都一样
打包后大小(vendor是react react-dom prop-types redux react-redux,common是自己定义的方法,main是上面引入antd的文件)
babel-plugin-import最下面有个官方解释是
babel-plugin-import will not work properly if you add the library to the webpack config vendor.
我确实在webpack.plugins写过下面的做法
请问下这样的话该如何解决???
项目地址在这里
人家都说了,在
vendor
下不支持。如果使用
vendor
打包,可以使用cdn
.其实
1M
真的不算大。我们项目大于1M
的很多。