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

bunlde size too large #325

Open
tangjinzhou opened this Issue Dec 20, 2018 · 7 comments

Comments

Projects
None yet
7 participants
@tangjinzhou
Copy link
Member

commented Dec 20, 2018

For bunlde size too large, you can optimize from the following three aspects:

More discussion about optimizing Icon

@tangjinzhou tangjinzhou pinned this issue Dec 20, 2018

@sk0x0y

This comment has been minimized.

Copy link

commented Dec 21, 2018

umi.js can work on vue?

@zhe-he

This comment has been minimized.

Copy link

commented Dec 25, 2018

有没有某个工具检测项目中哪些地方运用到了某些组件,然后按需引入,而不必手动按需引入

@yugasun

This comment has been minimized.

Copy link

commented Jan 15, 2019

@zhe-he 我自己写了个简单的小工具,可以实现自动获取组件是引入的组件,然后自己可以根据获取的使用组件列表,来书写按需注入代码。项目在这里:https://github.com/yugasun/auto-detect-component

@dnstfly

This comment has been minimized.

Copy link

commented Jan 22, 2019

有好的解决方案了么?打包后的文件太大了,Icon的svg图标占了400多kb

@xxyuk

This comment has been minimized.

Copy link

commented Feb 18, 2019

仔细查看了 antd vue 的相关源码,我觉得把 moment 替换成 2kb 大小的 dayjs 是一个可行的优化。代码层面基本没有太多的改变,打包体积能把 moment 的 100kb 缩减成 10 kb 以内。

如果 @tangjinzhou 有兴趣的话 我可以提供一些帮助 谢谢

Day.js 2KB immutable date library alternative to Moment.js with the same modern API
https://github.com/iamkun/dayjs

@tangjinzhou

This comment has been minimized.

Copy link
Member Author

commented Feb 18, 2019

@xxyuk 非常感谢你的建议!
不过 day.js 替换 moment 短期内应该不会,这个主要还是和 antd 同步
相关讨论可以参考 ant-design/ant-design#10437

另外,可以通过 webpack 进行 moment 优化,代码体积还在在可接受范围内的
优化参考 https://github.com/jmblog/how-to-optimize-momentjs-with-webpack

@atjason

This comment has been minimized.

Copy link

commented Apr 1, 2019

哎,按需要加载一个 Button,结果打包后就 566 KB,头疼…

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.