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

Regression: Unused moment.js is now included in bundle #19086

Closed
1 task
tony-scio opened this issue Oct 2, 2019 · 3 comments · Fixed by #19115
Closed
1 task

Regression: Unused moment.js is now included in bundle #19086

tony-scio opened this issue Oct 2, 2019 · 3 comments · Fixed by #19115
Assignees
Labels
🐛 Bug Ant Design Team had proved that this is a bug. 👷🏻‍♂️ Someone working on it

Comments

@tony-scio
Copy link

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

What is expected?

A trivial webpack app that uses should not include moment.js in the bundle. In 3.20.7 and earlier, this was the case.

What is actually happening?

In 3.21.0 and newer, this simple app pulls in moment.js which bloats the bundle by about 40k even though it's unused. It looks like this was introduced by #17816 which made ConfigProvider depend on LocaleProvider which depends on moment. I believe a fix would be to separate ConfigProvider and ConfigConsumer into separate files.

Environment Info
antd 3.23.5
React 16.10.1
System OSX 10.14.6
Browser Chrome 77.0.3865.90 (Official Build) (64-bit)

This bundle size regression is blocking our ability to upgrade past 3.20.7.

@afc163 afc163 added the 🐛 Bug Ant Design Team had proved that this is a bug. label Oct 3, 2019
@afc163
Copy link
Member

afc163 commented Oct 3, 2019

same as umijs/babel-plugin-import#352

@tony-scio
Copy link
Author

Yep, without being able to read that bug exactly, it looks the same. But it seems to talk a lot about locales. So I'd also like to clarify that the issue isn't just about locales.

We strip moment locales via:

new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),

But even the base moment.js without locales is still too bloated for our initial bundle.

@yoyo837
Copy link
Contributor

yoyo837 commented Oct 8, 2019

ref: #19030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug. 👷🏻‍♂️ Someone working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants