Ant-design-vue: 按需加载只引入Button组件,为什么还是会直接把icon全部打包呢,都没有使用icon组件。

Created on 20 Aug 2019  ·  7Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.3.15

Environment

window10,chrome76,vue2.6.10

Reproduction link

Edit on CodeSandbox

Steps to reproduce

按需加载antd组件,页面有且仅引入一个button组件。

What is expected?

在没有使用icon组件的时候,可不可以把icon图标库不打包到项目里,实在太大了。QAQ

What is actually happening?

为什么会把icon所有图标给全部打包?

Feature Request enhancement

Most helpful comment

@panpanpandas @zfha
https://github.com/vueComponent/pro-layout/blob/master/examples/src/core/antd/icons.js
https://github.com/vueComponent/pro-layout/blob/master/examples/vue.config.js#L39-L43

另外 有疑问请开新 issue。在已关闭的 issue 中继续回复可能会得到不到反馈

All 7 comments

暂时不可以,
可以关注下这个 https://github.com/ant-design/ant-design-icons/issues/104 已经在优化中了

同求按需加载,或者给一个选项把icon去掉,打包以后文件太大了。。。

还没解决么?

@panpanpandas @zfha
https://github.com/vueComponent/pro-layout/blob/master/examples/src/core/antd/icons.js
https://github.com/vueComponent/pro-layout/blob/master/examples/vue.config.js#L39-L43

另外 有疑问请开新 issue。在已关闭的 issue 中继续回复可能会得到不到反馈

@sendya 您好,我并不需要引入icon,我只是引入了button就出现了上面的问题。

@sendya 您好,我并不需要引入icon,我只是引入了button就出现了上面的问题。

我给你的是目前的解决方案**。 引入 button 必定会引入 icon,这在目前是无法解决的,从设计上就是如此。因为 button 有 icon 属性,用到了 icon 组件

@ 你好

@panpanpandas @zfha
https://github.com/vueComponent/pro-layout/blob/master/examples/src/core/antd/icons.js
https://github.com/vueComponent/pro-layout/blob/master/examples/vue.config.js#L39-L43

另外 有疑问请开新 issue。在已关闭的 issue 中继续回复可能会得到不到反馈

你好 我按照你这么配置在开发环境能够正常启动,但是打包时就报错了,报错如图 ! 是这么配置过后不能用别名了吗?
image

Was this page helpful?
0 / 5 - 0 ratings