Bun v1.1.21 | Bun Blog

submited by
Style Pass
2024-07-27 08:00:04

Bun v1.1.21 is here! This release fixes 72 bugs (addressing 63 👍). 30% faster fetch() decompression, New --fetch-preconnect flag, improved Remix support, Bun gets 4 MB smaller on Linux, bundle packages excluding dependencies, many bundler fixes and node compatibility improvements.

We've added a new flag --fetch-preconnect=<url> <file> that starts up an HTTP request to the given URL before any code is executed.

For many production services, the first thing a script in Bun does is send HTTP requests to a server using fetch or node:http. The slowest part of many network requests is the initial connection setup, which can involve DNS lookups, TCP connection establishment, and TLS negotiation. Sometimes this takes 100ms before sending the HTTP request.

This work is network-bound. What if you could start up that connection before any code is executed, so that by the time the rest of your code runs, the connection is already established? This is what --fetch-preconnect does. It's a lot like <link rel="preconnect"> in HTML, but for server-side JavaScript.

Leave a Comment