On September 2023, 9, the runtime Bun officially released version 8.1, marking the official entry of the project created by former Facebook engineers into stable production usability. Bun's vision is to make front-end development "lightning fast" through deep integration. Can this new force shake the status of the established overlord Node and become the next generation of front-end development standards? Let's get a glimpse of the power of this new star.
Bun is more than just a runtime. It is also:
A package manager (like Yarn, NPM, PNPM)
A build tool (similar to Webpack, ESBuild, Parcel)
A test runner
and more..
So Bun can install dependencies by reading package.json. Bun can also run scripts. Whatever it does, it's faster than other tools. Bun has experimented with many aspects of the JavaScript ecosystem, with a focus on performance. It prioritizes support for standard web APIs such as Fetch. It also supports many Node.js APIs, making it compatible with most NPM packages.
To install Bun:
// npm
npm install -g bun
// brew
brew tap oven-sh/bun
brew install bun
// curl
curl -fsSL https://bun.sh/install | bash
// docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
Update Bun:
bun upgrade
Here's a look at what Bun is and what updates 1.0 brings!
Bun: The all-around toolkit
JavaScript is mature, fast-moving, and has a vibrant and passionate developer community. However, since the release of Node .js 14 years ago, JavaScript's toolchain has become larger and more complex. This is because in the process of development, various tools are gradually added, but there is no unified centralized planning, resulting in the lack of integrity and efficiency of the toolchain, which becomes slow and complex.
Why did Bun appear?
Bun's goal is simple: to eliminate the slowness and complexity of JavaScript toolchains, but at the same time retain the benefits of JavaScript itself. Bun wants to allow developers to continue using their favorite libraries and frameworks without having to abandon the specifications and conventions they are already familiar with.
To achieve this, it may be necessary to give up some tools that become unnecessary after using Bun:
Node.js: A drop-in alternative to Bun, so the following tools are no longer needed:
node
npx
:Bun's command is 5 times faster than.bunxnpx
nodemon
: Bun has a built-in listening mode and does not need to be used.nodemon
dotenv
,:Bun supports the configuration of reading files by default.cross-env.env
Transpiler: Bun can run 、、、 and files, so the following tools are no longer needed: .js
.ts
、.cjs
.mjs
.jsx
.tsx
tsc
: You can still keep it for type checking!babel
,,: No more transpiling with Babel..babelrc@babel/preset-*
ts-node
,:Bun can run TypeScript files directly.ts-node-esmtsx
: Bun can run TypeScript's JSX files directly.
Build tools: Bun has top-notch performance and an esbuild-compatible plugin API, so the following tools are no longer needed:
esbuild
webpack
parcel
,.parcelrc
rollup
,rollup.config.js
Package manager: Bun is an npm-compatible package manager that can use familiar commands. It can read files and write dependencies to directories, behaving similarly to other package managers, so it can replace the following tools: package.jsonnode_modules
npm
, ,.npmrcpackage-lock.json
yarn
,yarn.lock
pnpm
,pnpm.lockpnpm-workspace.yaml
lern
Test Library: Bun is a Jest-enabled test runner with features such as snapshot testing, simulation, and code coverage, so the following test-related tools are no longer needed:
jest
,jest.config.js
ts-jest
, ,@swc/jestbabel-jest
jest-extended
vitest
,vitest.config.ts
Although these tools have their own advantages, using them often requires them all to be integrated, which can lead to a slow and complex development process. Bun provides the best developer experience by being a single toolkit, from performance to API design.
Top comments (0)