Bun re-thinks the whole node package management structure of using node_modules to store all packages. You'll just need to use bun, Instead of 1,000 node_modules for development.
Bun Features
- Web API's such as fetch, WebSocket, and ReadableStream are build into Bun.
- Built from scratch JavaScript/TypeScript/JSX transpiler.
- A JavaScript & CSS bundler
- A Task runner for package.json scripts
- A package manager that is compatible with NPM.
Getting started with Bun
To get start with bun you need to install bun using the bun install script.
curl https://bun.sh/install | bash
In order to use bun command on terminal add the following environment to your .bashrc in $HOME/.bashrc.
$HOME/.bashrc
...# Bun environment variablesexport BUN_INSTALL=\"$bun_installexport PATH=\"\$BUN_INSTALL/bin:\$PATH
Commands Overview
Installing packages:
bun install
Add package:
bun add react
Remove package:
bun remove react
React App With Bun:
bun create react ./appcd appbun dev # start dev server
Nextjs App with Bun:
bun create next ./appcd appbun dev # start dev server
Benchmark Overview
On Linux, bun install install's packages 20x - 100x faster compared to npm install. On macOS, it’s more like 4x - 80x.
Conclusion
Bun is fairly new and i wouldn't recommend anyone to run it in production as its still experimental and bugs are expected. However the concepts are really solid. It feels like bun is trying to re-think the whole node ecosystem while bringing in backward compatibility of node packages. Would love to see what this projects morph's to in the future.
Wonderful
ReplyDelete