babel-plugin-import icon indicating copy to clipboard operation
babel-plugin-import copied to clipboard

引入组件将icon全部加载进来了,无法按需加载

Open LYfirstday opened this issue 6 years ago • 7 comments

使用ts时根据Issues里面的建议,发现配置完后随便加载一个组件就500多kb,经过多方查询发现是把icon给加载进来了,完全没用到就白白多500多Kb,这个要怎么解决 image

tsconfig.json部分配置 image

webpack.config.js部分配置

image

期望按需加载,但是实际只要引入跟icon有关的组件都是500多Kb,太大了

typescript: 3.1 antd: 3.13.6 webpack: 4.29.5

LYfirstday avatar Feb 25 '19 08:02 LYfirstday

purched-antd-icons u need this.

willylee007 avatar Feb 27 '19 08:02 willylee007

@willylee007 how can i use this? I`m try,but it does not work

LYfirstday avatar Feb 28 '19 12:02 LYfirstday

用了一下这个purched-antd-icons, 还是有点问题。 部分图标没导入

willylee007 avatar Mar 02 '19 05:03 willylee007

原来你用了ts。 你应该去ts-import-plugin留issue的。

willylee007 avatar Mar 15 '19 04:03 willylee007

ts-import-plugin的issue我看了一圈 没解决问题...现在在用Material, 有点难用 0 0!

LYfirstday avatar Mar 15 '19 04:03 LYfirstday

后来我在新工程用了这个脚手架react-scripts-ts-antd, 新工程还不用剔除Icon 旧工程用这个剔除Antd里的Icon purched-antd-icons, 部分没有的Icon用iconfont的图标替换, 完美解决

willylee007 avatar Mar 15 '19 05:03 willylee007

多谢推荐,我周末试下 @willylee007

LYfirstday avatar Mar 15 '19 05:03 LYfirstday