Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ›[BUG] @ant-design/icons are not treeshaked and all of them are added to the bundle #6404

Closed
mxschmitt opened this issue Apr 16, 2020 · 2 comments

Comments

@mxschmitt
Copy link

mxschmitt commented Apr 16, 2020

πŸ› bug 描述

@ant-design/icons are not treeshaked and by that all 1.26 MB are added to the bundle.

Related ant-design/ant-design#12011

Feel free to transfer this issue to other Ant Design repositories.

πŸ“· 倍现ζ­₯ιͺ€

  1. Clone the Ant Design Pro repository
  2. Install webpack-bundle-analyzer via NPM / Yarn
  3. Add that to your config:
  chainWebpack: (config) => {
    const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
    config.plugin("BundleAnalyzerPlugin").use(BundleAnalyzerPlugin)
  },
  1. Build the project

🏞 ζœŸζœ›η»“ζžœ

Treeshaked Ant Icons, so not all of them are always loaded.

πŸ’» 倍现代码

Β© η‰ˆζœ¬δΏ‘ζ―

  • Ant Design Pro η‰ˆζœ¬: 4.1.3
  • umi η‰ˆζœ¬: 3.1.1
  • ζ΅θ§ˆε™¨ηŽ―ε’ƒ: Chrome 80
  • εΌ€ε‘ηŽ―ε’ƒ macOS

πŸš‘ 兢他俑息

image

@chenshuai2144
Copy link
Collaborator

you can use news prolayout plugins
it only load used icons

@mxschmitt
Copy link
Author

@chenshuai2144 which one exactly? I've used:

  • umi-plugin-antd-icon-config
  • umi-plugin-antd-theme
  • umi-plugin-pro

all of them don't fix the issue that all icons were included in the bundle. I'm referring to the official template, where this issue is also persistent. Thats's why I'm so confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants