-
Notifications
You must be signed in to change notification settings - Fork 594
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
Bundling undici with rollup results in circular dependency and node:sqlite(?) getting included #4005
Comments
I 100% agree on the point of the circular dependency. The |
Thanks for the quick response, @mcollina. I'll raise an issue for Rollup then. 😉 |
For reference: rollup/rollup#5800 |
We should solve the circular dependency here. |
#4006 fixes the circular dependency |
Wow, that was fast! Thanks a lot! |
@mcollina, I noticed that including undici just to add proxy support to fetch increases the size of the final bundle by almost 500kb. That's quite unfortunate for my use-case (a CLI tool which, without undici, is just 90 kb). TBH, proxy support in Node packages has always been an afterthought and every time I'm tasked with adding it, I know for sure I'm gonna run into weird edge-cases and will be spending the next two days banging my head against the wall. Is there maybe something we could do about it? 🙏 I updated the repository with a working rolldown example (which doesn't have the bundling problem like rollup) and also included the final bundle sizes in the README.md. |
Frankly we should just add it out of the box if the right headers are set (both here and in Node.js). In other terms, if Line 10 in 7f635e5
There is also nodejs/node#43187 (requires a champion and it's likely a lot of work). |
That'd be much appreciated! It seems like Line 10 in 7f635e5
with setGlobalDispatcher(new EnvHttpProxyAgent()) Or would we rather check for the existence of the proxy environment variables again inside |
|
@mcollina What do you think? Shall we reopen this issue or create a new one regarding out-of-the-box proxy support? |
Bug Description
I needed proxy support for node's built-in
fetch
. So I installedundici
as a dependency and usedsetGlobalDispatcher
together withProxyAgent
. Afterwards my rollup build failed with:It also seems that
node:sqlite
is included in the final bundle. Do I need to configure rollup differently or is this a bug? I had no bundling problems before introducing undici…Reproducible By
Clone https://github.com/soulchild/undici-rollup-bundle-failure and run
npm run build
.Expected Behavior
rollup
should be able to bundleundici
without problems … and not includenode:sqlite
😉Environment
The text was updated successfully, but these errors were encountered: