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

Huge untreeshakable size increase due to undici #1697

Open
aminya opened this issue Apr 1, 2024 · 1 comment
Open

Huge untreeshakable size increase due to undici #1697

aminya opened this issue Apr 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@aminya
Copy link

aminya commented Apr 1, 2024

Describe the bug

@actions/http-client and all the packages like @actions/core are now shipping huge amounts of more JavaScript due to the inclusion of undici in a way that is not tree-shakable. Importing any simple function from @actions/core results in the bloat.

This has happened in the recent versions only. It seems the way undici is used results

To Reproduce
Bundle @actions/http-client using a bundler like Parcel

Expected behavior
Make the dependencies tree-shakable and lazy lodable via dynamic imports

Screenshots

Here's the bundling result in setup-cpp:

After updating the version (625 KB minified). Notice all the undici addition:


dist/legacy/setup-cpp.js                                                                        625.86 KB    1.23s
├── Code from unknown sourcefiles                                                                84.02 KB      0ms
├── node_modules/undici/lib/llhttp/llhttp-wasm.js                                                72.23 KB    119ms
├── node_modules/undici/lib/llhttp/llhttp_simd-wasm.js                                           72.21 KB    119ms
├── node_modules/undici/lib/client.js                                                            25.49 KB    141ms
├── node_modules/@actions/tool-cache/node_modules/semver/semver.js                               18.09 KB    149ms
├── node_modules/undici/lib/fetch/index.js                                                       16.29 KB    140ms
├── node_modules/undici/lib/fetch/request.js                                                      9.18 KB    127ms
├── node_modules/@actions/http-client/src/index.ts                                                9.09 KB      0ms
├── node_modules/undici/lib/fetch/util.js                                                         7.78 KB    114ms
└── node_modules/undici/lib/cache/cache.js                                                         7.2 KB    105ms
└── + 355 more assets

Before updating (237 KB minified)

dist/legacy/setup-cpp.js                   237.83 KB    841ms

Related to #1560
#1561

@fregante
Copy link

My bundle is now 1901kB and I only include @octokit/action and @actions/core. I think that there's huge margin for improvement here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants