[UtooPack] Bundle Size Optimization #2137
fireairforce
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
目前 utoopack 的产物体积在 umd 产物上对比 webpack 生产环境产物存在约 ~10kb 左右的裂化(参考: ant-design/ant-design#54534 (comment)) ,在基础的 bundler size 优化上,webpack 与 utoopack 均开启了 scopeHoisting,但目前 utoopack 还没开启 innerGraph 优化 https://nextjs.org/docs/app/api-reference/turbopack#bundle-sizes. 因此基准上存在差距也还算合理。
同时目前 utoopack 的 runtime function 体积默认比 webpack 产物体积在 minfify 上大约6-9kb,这部分目前有一定的优化空间,但不是特别大。
目前 antd-tools 针对 antd 产物体积也有一些其他的优化配置,例如对于 moment.js 依赖的 noParse: https://github.com/ant-design/antd-tools/blob/master/src/getWebpackConfig.ts#L112
实际上目前使用 father 的 webpack bundler 配置去构建 antd umd 本身体积也会比 antd-tools 大更多,说明两边还是存在一些配置上的差距。
可以参考: https://dev.to/filipsobol/downsize-your-javascript-mastering-bundler-optimizations-2485#:~:text=A%2019.5%25%20difference%20in%20output%20size%20is%20substantial%3A%20on%20a%20slow%203G%20connection%2C%20the%20smallest%20bundle%20might%20take%20around%205.7%E2%80%AFs%20to%20download%2C%20while%20the%20largest%20closer%20to%207%E2%80%AFs.%20Parsing%20and%20execution%20times%20also%20scale%20with%20bundle%20size%2C%20so%20the%20real%2Dworld%20difference%20could%20be%20even%20more%20noticeable. 来做一些优化。
Beta Was this translation helpful? Give feedback.
All reactions