Bundling undici with rollup results in circular dependency and node:sqlite(?) getting included #4005
Closed
Description
Bug Description
I needed proxy support for node's built-in fetch
. So I installed undici
as a dependency and used setGlobalDispatcher
together with ProxyAgent
. Afterwards my rollup build failed with:
> rollup -c
./index.js → test...
(!) Unresolved dependencies
https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
node:sqlite (imported by "node:sqlite?commonjs-external")
(!) Circular dependency
node_modules/undici/lib/web/websocket/util.js -> node_modules/undici/lib/web/websocket/connection.js -> node_modules/undici/lib/web/websocket/util.js
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 bundle undici
without problems … and not include node:sqlite
😉
Environment
- macOS 15.2
- Node v22.10.0