Make moment.js tree-shakable by moving ConfigConsumerProps to own file (v1) #3524
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a ...
What's the background?
If an app only wants to import some components, the import package size should be small. e.g.
But this creates a 400KB bundle 😨 with most of it being moment.js

Badge imports moment.js this way:
ant-design-vue/components/badge/Badge.jsx
Lines 43 to 45 in 0f46769
ant-design-vue/components/badge/Badge.jsx
Line 14 in 0f46769
ant-design-vue/components/config-provider/index.jsx
Lines 85 to 91 in 0f46769
ant-design-vue/components/config-provider/index.jsx
Line 6 in 0f46769
ant-design-vue/components/locale-provider/index.jsx
Line 2 in 0f46769
So by moving
ConfigConsumerProps
out ofcomponents/config-provider/index.jsx
, moment.js will not be imported and now bundle takes only 80KB.(moment.js will still be imported if e.g.
import { ConfigProvider, Calendar } from 'ant-design-vue';
).What's the effect?
If user imports only a few components, their tree-shaked bundle will not include moment.js, reducing their bundle size
Make moment.js tree-shakable
No
Changelog description (Optional if not new feature)
Make moment.js tree-shakable
Self Check before Merge