toolkit
toolkit copied to clipboard
fix: lazy load ProxyAgent to avoid bundling all the undici
This makes the loading of undici conditional by lazy loading it inside the actual function that needs the ProxyAgent.
undici is a huge library, and here it is being imported unconditionally, which results in 500KB bloat in the bundles of http-client. By requiring only what is needed and when it is needed, this issue is resolved.
Fixes #1560 Closes #1561