Skip to content
ai news

Bun 1.4: The Update That Kills Your Dependencies

Bun's controversial Rust rewrite is here, and it’s not just about speed. A new built-in standard library aims to eliminate dependency bloat and secure your supply chain, but does it go too far?

Jonah Park
Bun 1.4: The Update That Kills Your Dependencies

The JavaScript Standard Library We Never Had

JavaScript's ecosystem has long contended with the absence of a comprehensive standard library. This void compelled developers to integrate numerous micro-packages, contributing to significant project dependency bloat and increasing exposure to supply chain vulnerabilities. This reliance on fragmented third-party solutions became a persistent architectural challenge.

Bun 1.4, introduced as The Rust Rewrite, directly confronts this issue. The runtime now bundles essential, high-performance utilities, engineered in Rust, to provide core functionalities previously requiring external packages. This eliminates the need for upwards of 15 common dependencies across various project types.

Specific examples of dependency replacement include:

  • Bun.WebView replacing Playwright and Puppeteer for headless browser control.
  • Bun.Image handling image manipulation, negating the need for libraries such as Sharp.
  • Bun.Markdown integrating robust markdown parsing.
  • Bun.Terminal offering a built-in pseudo-terminal, removing reliance on node-pty.

This integrated approach signals a major philosophical shift for the JavaScript ecosystem. It moves away from a culture of piecemeal micro-packages toward a more robust, 'batteries-included' runtime. Bun 1.4 aims to consolidate foundational capabilities, fostering greater stability and reducing project overhead.

Kill Puppeteer & Sharp with Native APIs

Bun 1.4 introduces Bun.WebView, a built-in headless browser for automation, designed to replace dependencies such as Playwright and Puppeteer. On Mac, Bun.WebView utilizes the system’s WebKit, the engine powering Safari, requiring no additional installations. For Windows and Linux users, it leverages an existing Chrome or Chromium instance, capable of running a headless sub-process or connecting to an already open browser.

This native integration dispatches native browser events for interactions, making clicks, typing, and scrolling appear more human to web pages. Its API covers fundamental operations such as finding elements, clicking, typing, and executing page-specific JavaScript via evaluate. While effective for lightweight browser automation and scraping, Bun.WebView does not yet fully replace tools like Playwright, lacking features such as a test runner or trace viewer.

Further reducing dependency bloat, Bun.Image serves as a powerful replacement for Sharp. This native image library offers chainable operations directly within Bun. Developers can resize, rotate, flip, adjust brightness and sharpness, and convert image formats efficiently. Bun.Image also reads metadata, including width, height, and format, without requiring full pixel data decoding. This eliminates the need for complex native builds and addresses deployment issues often encountered with external image processing libraries.

Your Dev Workflow, Now Built-In

Bun 1.4 introduces a built-in script runner, eliminating external dependencies like concurrently or npm-run-all. Developers can now execute multiple package.json scripts concurrently using --parallel or sequentially with --sequential. This feature includes output prefixed by script name, glob matching for script names, and workspace filtering. An option also allows other scripts to continue even if one errors out.

For task scheduling, Bun.cron replaces packages such as node-cron. It supports two modes: a function runs on the event loop for simple jobs, while a script registers a native OS-level cron job. These system-level jobs leverage crontab on Linux, launchd On Mac, and the Task Scheduler on Windows for robust, persistent execution. Standard cron syntax, including named days and helpers like daily, is supported.

A pseudo-terminal API, Bun.Terminal, integrates directly into the runtime, removing the need for node-pty. This allows JavaScript to drive interactive command-line applications like Bash, Vim, or Htop. Bun.spawn gains a terminal option, ensuring sub-processes receive a genuine terminal environment for colored output, cursor movement, and interactive prompts. For more details on these and other features, consult the Bun 1.4 release notes.

Enjoying this? Get one like it in your inbox each morning.

one email a day · unsubscribe in two clicks · no third-party tracking

The Rust Rewrite's True Dividend

Bun 1.4's foundational Rust Rewrite delivers substantial performance gains, the true dividend of the re-architecture. This re-engineering yields faster startup times and measurably lower CPU usage for all operations. Notably, the Bun binary is 17% smaller, even with the addition of extensive new functionality like Bun.WebView and Bun.Image.

Additional utilities further streamline development workflows. Bun.Archive provides a fast, native implementation for inspecting tarballs, allowing developers to read specific files, such as a package.json from a .tgz archive, without full extraction. Bun also introduces native support for parsing and stringifying both JSON5 and XML, removing the need for third-party libraries for these common data formats.

A significant quality-of-life improvement for package management is the new global virtual store, isolatedLinker. This feature saves considerable disk space by symlinking installed packages into individual project node_modules folders, rather than duplicating them. The isolatedLinker also accelerates subsequent bun install commands across multiple projects, boosting overall developer efficiency.

Frequently Asked Questions

What is the biggest change in Bun 1.4?

The 'Rust Rewrite' introduces a powerful built-in standard library, aiming to replace over 15 common NPM dependencies for tasks like browser automation, image processing, and cron jobs, directly within the runtime.

Does Bun 1.4 fully replace Playwright or Puppeteer?

Not completely. Bun.WebView is excellent for lightweight browser automation, scraping, and UI scripting. However, it currently lacks advanced features found in Playwright, such as a dedicated test runner and trace viewer.

What are some key dependencies Bun 1.4 can replace?

Bun 1.4 can replace packages like Playwright/Puppeteer (Bun.WebView), Sharp (Bun.Image), Marked (Bun.Markdown), node-cron (Bun.cron), concurrently (parallel scripts), and various tar and ANSI string libraries.

How does Bun 1.4's global virtual store work?

When the 'isolatedLinker' is enabled, bun install extracts packages to a single global store on your machine. It then uses symlinks to connect them to your project's node_modules, saving significant disk space and speeding up installations across multiple projects.

Found this useful? Share it.

For builders

Want Stork to write one of these about your product?

Send us a URL. We use the product, form a view, and publish what we actually think — in 8 languages, labeled Sponsored, with no copy approval on your side. That last part is what makes it worth quoting.

See how it works$500 · AI tools & software only