@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
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 ofundici
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:Before updating (237 KB minified)
Related to #1560 https://github.com/actions/toolkit/pull/1561