News & Announcements

Fresh out of the oven: Bun support in Builds

At Netlify we believe that stability and reliability don’t necessarily need to conflict with one’s ability to experiment with new technologies. We’re confident the same applies to the tooling we all use and, as such, it’s our job as the platform of choice for web development to ensure our customers have access to ways they can safely experiment with new tools that could bring added value to their development process. We want to make sure Netlify is the right oven for any kind of project and team, hence why we’re excited to announce Netlify Builds now have out of the box (or should we say out of the oven?) support for Bun.

Runtime? Package Manager?

Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It offers not only a JS runtime but also package manager capabilities. We want to make sure our customers have the ability to leverage the best of the tool without too much setup hassle, so our support comes in two fronts.

  • Just as we do for other JS runtimes such as Node.js and Deno we now expose the bun executable at build time so that folks can run their build commands using bun runtime if they choose to.
  • Install and setup of JS dependencies by automatically detecting the presence of a Bun lockfile (bun.lockb) and using bun install when building a project in our platform.

How to use Bun with Netlify

You can start using bun runtime right away by using the bun executable in your build command. Either through your netlify.toml:

[build]
  command = "bun run build"

Or by editing your build command in the configuration UI.

To leverage Bun’s package manager capabilities you can do so by running bun install locally in your project. This will generate a bun.lockb file you should commit and push to your project (more details on Bun’s lockfile can be found in their docs). When Netlify Build detects the presence of this file in your repository we’ll run bun install instead of npm (our default package manager). It’s that simple!

⚠️ Make sure you have no other lockfiles (package-lock.json, yarn.lock or pnpm-lock.yaml) in your repo and no packageManager option set in your package.json since we’ll be favouring those tools by default.

Check our docs for further information on how to configure Bun’s package manager capabilities in Netlify.

Try it out and let us know!

We would love to hear about your experience through our support portal or our community forum. We deeply value your feedback and we’re always keen on hearing back from our amazing community.

Keep reading

Recent posts

How do the best dev and marketing teams work together?