DEV_TOOLBOX

Bun

Bun is a JavaScript runtime, package manager, test runner and bundler built from scratch using the Zig programming language which is also known to be BLAZINGLY FAST like Rust.

It's 4x faster than Node.js (Even if it's not 4x, it's still faster in my experience which makes it a great choice simple projects like this one).

Installation

There are multiple ways to install Bun. Two of which are:

  • Scoop
  • or through Node's package managers
# Using Scoop
scoop install bun
 
# Using NPM
npm install -g bun

Usage & Commands

IMPORTANT

Disable corepack before using. On Windows 10, the packageManager field in package.json will be set to yarn which is not intended.

If you've used node package managers before, you'll be familiar with Bun's commands.

Moving forward, we can assume some of the commands are the same as yarn/pnpm as well as the flags that are often used.

bun add

Really similar to yarn/pnpm add.

bun add <package>

bun run

Really similar to yarn/pnpm run. We can omit run like yarn/pnpm

bun run <script>
# or
bun <script>
 
# Example
bun dev
bun start

WARNING

Not sure if it's only for windows, but for build script, we need to use bun run build instead of bun build or we'll encounter an error saying something along the lines of bun build is used to build bun or something.

bun install

Really similar to yarn/pnpm install.

bun install <package>

bun remove

Really similar to yarn/pnpm remove.

bun remove <package>