Member-only story
3 Ways To Use Bun With Create React App
Exploring bun.js using Create React App (CRA)

What is Bun?
A bun is an unsweet bread roll typically filled with savory fillings, such as hamburger. Baozi, or bao, is a yeast-leavened-filled bun in various Chinese cuisines. There are many variations in fillings (meat or vegetarian) and preparations, though the buns are most often steamed. Bao typically looks like the above image, and Bao is also a short film made By Disney Pixar.
In this article, we talk about a different bun, which is a fast all-in-one JavaScript runtime. Bun is a modern JavaScript runtime like Node or Deno, with a native bundler, transpiler, task runner, and npm client built-in — all in Bun.
Bun.js was created on April 2021, and it is fairly young. The latest Bun version is 0.1.7, which was released on August 6, 2022. It is not production-ready yet.
Bun is fast, and its performance comes from the following technologies:
- JavaScriptCore: It is a built-in JavaScript engine for WebKit, which is faster than V8.
- Zig: It is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
- esbuild: It is an extremely fast JavaScript/CSS bundler and minifier.
Bun internally uses ESM, although it also supports CommonJS. It has built-in Web APIs, such as fetch, WebSocket, and ReadableStream. In Bun, every file is transpiled. Therefore, TypeScript and JSX just work. It is a great and complete tool as a bundler, transpiler, and package manager.
Install Bun
Run the command, curl https://bun.sh/install | bash
, to install Bun:
- As it shows in line 7, the Bun path has been added to
.zshrc
.