use esbuild define/hooks by KhafraDev · Pull Request #2342 · nodejs/undici (original) (raw)
The bundle file now compiles the relevant code to:
if (!httpRequest.headersList.contains("user-agent")) { httpRequest.headersList.append("user-agent", false ? "undici" : "node"); }
while for npm users it will be:
if (!httpRequest.headersList.contains('user-agent')) { httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') }
much simpler