MITB Banner

Bun.js is the New Node.js Killer

Unlike Node and Deno, which work on V8, Bun uses JavaScript Core from Webkit.

Share

Listen to this story

Out of intense complexities, simplicities emerge: Winston Churchill. Who would have thought the “man of great quotes” was referring to JavaScript runtime ‘Bun’, which was born nearly 100 years after this famous quotation?

For 13 whole years, ‘Node.js’, a Javascript runtime environment, was an indisputable champion. Now, it seems that its days are over. Node founder Ryan Dahl is disappointed with his own invention and has now launched ‘Deno’, a modern runtime for JavaScript and TypeScript. 

But, Dahl was not the only smart person in the room. Jarred Sumner, another genius, was too troubled with how everything was so slow on JavaScript, when he decided to bake ‘Bun’.

He developed Bun, a JavaScript runtime, in the Zig programming language, which also supports web standards while aiming for Node.js API compatibility to make it simpler for developers to port over existing code.

Bun is a JavaScript runtime with a native bundler, transpiler, task runner, and npm client built-in. It’s a contemporary JavaScript runtime, similar to Node or Deno. 

According to the website, Bun is intended to be a drop-in replacement for your existing JavaScript and TypeScript apps or scripts on your local computer, server, or edge. Bun supports hundreds of Node.js and Web APIs natively, including 90% of Node-API functions (native modules), fs, path, Buffer, and others.

Bun aims to run the majority of JavaScript outside of browsers, enhancing infrastructure performance and complexity as well as developer productivity with better, more user-friendly tools.

Betting big on speed?

Bun was created from scratch with three primary goals in mind: starting fast (with the competitive edge in mind), achieving new levels of performance (by extending the JavaScriptCore, the engine), and being a fantastic and comprehensive tool (bundler, transpiler, package manager).

Most of Bun is written from scratch including the npm client, bundler, JSX/TypeScript transpiler, SQLite client, HTTP client, WebSocket client, and more.

Unlike Node and Deno, which work on V8—a JavaScript engine developed by the Chromium Project for Google Chrome, Bun uses a different JS engine. It uses JavaScript Core from Webkit, which is generally considered faster. In addition, it’s written in a low-level programming language called ‘Zig’.

According to the official website, “Bun’s goal is to run the majority of the world’s JavaScript outside of browsers, improving future infrastructure performance and complexity while increasing developer productivity with better, simpler tooling.”

Meanwhile, users have also pointed out some drawbacks of the software.

Highlighted issues

Bun currently does not have a debugger. 

There are also issues with bundling and transpiling. There are different frameworks out there, Angular, Svelte, Vue, and others, which have different file formats, but these frameworks cannot be used with Bun.js yet.

There’s JavaScript XML, which allows coders to write HTML in React, Angular, Svelte, and Vue however you cannot use it with Bun.js at the moment.

Bun.js comes with TypeScript support out of the box, and they’re making the same error Deno developers made—albeit on a larger scale owing to bundling/transpiling—and support needs to be provided for the core Bun.js to stay up with TypeScript improvements. 

To receive the latest TypeScript features, you’ll have to wait for Bun.js to add support for it as well.

Trying to please everyone

Bun attempts to be an all-in-one tool, which places a significant responsibility on its contributors and is causing problems. 

Bun should consider having small separate tools that accomplish one thing well but can nevertheless function organically with each other. Bun.js has currently placed all the elements in one plate which users will have to separate, pick, and use.

Bun-core, a runtime and package manager, might be the solution. It would offer the essential functionality needed to power our application with incredible speed and little overhead. Then, a separate module might be installed using a built-in package management to provide features like bundling or transpiling, support for different frameworks, and more. The bun-core could then expose API to extend it with the modules—our ingredients.

Meanwhile, Node is still routinely updated, with version 18.0 recently released, and its future is seemingly secure even with Deno and Bun around. Node is used in the infrastructures of many companies, like PayPal, with new startups following suit.

Bun.js is still in beta and has minimal support—you’d need Windows Subsystem for Linux to run it on Windows. Despite its various features, it cannot yet be considered for production-ready software because there is still much work to be done on it.

Share
Picture of Tausif Alam

Tausif Alam

Tausif Alam has been covering technology for almost a decade now. He is keen about connecting dots and bringing a wholesome picture of the tech world.
Related Posts

CORPORATE TRAINING PROGRAMS ON GENERATIVE AI

Generative AI Skilling for Enterprises

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

Upcoming Large format Conference

May 30 and 31, 2024 | 📍 Bangalore, India

Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

AI Courses & Careers

Become a Certified Generative AI Engineer

AI Forum for India

Our Discord Community for AI Ecosystem, In collaboration with NVIDIA. 

Flagship Events

Rising 2024 | DE&I in Tech Summit

April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore

MachineCon GCC Summit 2024

June 28 2024 | 📍Bangalore, India

MachineCon USA 2024

26 July 2024 | 583 Park Avenue, New York

Cypher India 2024

September 25-27, 2024 | 📍Bangalore, India

Cypher USA 2024

Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA

Data Engineering Summit 2024

May 30 and 31, 2024 | 📍 Bangalore, India

Subscribe to Our Newsletter

The Belamy, our weekly Newsletter is a rage. Just enter your email below.