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

antd 默认支持基于 ES modules 的 tree shaking,对于 js 部分,直接引入 import { Button } from 'antd' 就会有按需加载的效果。未生效 #24837

Closed
1 task
ghostjzf opened this issue Jun 8, 2020 · 6 comments

Comments

@ghostjzf
Copy link

ghostjzf commented Jun 8, 2020

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

Reproduction link

https://new-issue.ant.design/

Steps to reproduce

import {Button} from "antd"

What is expected?

自动加载样式

What is actually happening?

并没有自动加载,antd 默认支持基于 ES modules 的 tree shaking,对于 js 部分,直接引入 import { Button } from 'antd' 就会有按需加载的效果,文档上说这句话难道不是不需要babel-plugin-import 的意思吗

Environment Info
antd 4.3.3
React 16.13
System MacOS
Browser chrome
@afc163
Copy link
Member

afc163 commented Jun 8, 2020

对,我们不推荐用 babel-plugin-import 了。

详情见:

#24184
#23988

@afc163 afc163 closed this as completed Jun 8, 2020
@ghostjzf
Copy link
Author

ghostjzf commented Jun 10, 2020 via email

@afc163
Copy link
Member

afc163 commented Jun 10, 2020

对,建议全量引入。

@feishi20
Copy link

Don't use 'postcss-icss-keyframes' plugin with antd@v4, which may have conflict with some components like Select. #26252

@zerrol
Copy link

zerrol commented Jun 2, 2021

对,建议全量引入。

请问样式为什么建议全量引入,不会有影响加载速度的问题吗?

@yoyo837
Copy link
Contributor

yoyo837 commented Jun 2, 2021

可能是,css全量zip后也没多大,且一般能利用http缓存,花力气去支持部分引入成本不划算吧,不然你就用babel-plugin-import

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

No branches or pull requests

5 participants