Syed Umar AnisJavascriptTaking Bun JavaScript runtime for a spin
Syed Umar AnisJavascriptTaking Bun JavaScript runtime for a spin

Taking Bun JavaScript runtime for a spin

Bun has made a big splash on reaching version 1.0. It is so much faster than Nodejs and provides enough compatibility with Nodejs to get most people interested.

One of the key design decisions that helped Bun achieve this outstanding performance is to bundle all the tooling required for a typical JavaScript project into a single runtime. It is a JS runtime, a node-compatible package manager, and a test runner with built-in support for typescript. It does everything.

This is opposite to the Nodejs philosophy that lies on the ecosystem to provide other building blocks. I think both approaches have their merits, and the two projects will help each other push the JavaScript ecosystem forward.

I am going to create a SvelteKit application using Bun on MacOS. Let’s get started.

Install Bun

Let’s install it using Homebrew.

brew tap oven-sh/bun
brew install bun

Confirm that it is installed properly by running:

bun -version

Create SvelteKit project

bun create svelte@latest explore-bun

I selected the ‘Skeleton Project’ with TypeScript support and all 4 additional options for linting, formatting, unit testing and e2e testing.

Run the project

Install dependencies

bun install

Launch the app

bun --bun run dev

Developer Experience

Based on the little time I have spent with it, Bun looks great.

Here are some of the positives:

  • Hot module reloading works
  • It does feel faster

But I will not recommend it for developing a SvelteKit project at the moment:

Based on the hype and momentum, I think it won’t take long to overcome these teething issues.

Hi, I’m Umar

Leave a Reply

Your email address will not be published. Required fields are marked *