Introducing Rslib – ByteDance’s New Library Build Tool for ESM and CJS

The article introduces Rslib, the latest addition to ByteDance’s Rspack family, and reviews its features, roadmap, and how it complements Rspack, Rsbuild, Rspress, and Rsdoctor—highlighting performance, compatibility with Webpack ecosystems, and built‑in tooling for modern JavaScript libraries.

Full-Stack Cultivation Path
Full-Stack Cultivation Path
Full-Stack Cultivation Path
Introducing Rslib – ByteDance’s New Library Build Tool for ESM and CJS

Rslib

Rslib is a library‑build tool driven by Rsbuild that produces optimal ESM and CJS bundles. It eliminates the excessive runtime code that traditional bundlers such as Webpack and Rspack may inject into ESM packages, improving consumer friendliness. Rslib inherits the large Webpack/Rspack ecosystem—including tree‑shaking, code splitting, and module federation—and further optimizes ESM output quality.

Key features:

Zero‑config defaults – pre‑configured support for TypeScript, JSX, Sass, Less, CSS Modules and Wasm.

DTS generation – creates isolated declaration (DTS) files.

Module federation – enables micro‑frontend scenarios.

Asset compression – reduces output file size.

Type checking – adds static type verification.

PostCSS & Lightning CSS integration – simplifies CSS processing and optimization.

Ecosystem leverage – reuses Webpack and Rspack features such as tree‑shaking and code splitting.

Rslib is in early development; core functionality is targeted for Q3 2024 with a public stable release planned for Q4 2024.

Github: https://github.com/web-infra-dev/rslib

Rspack

Rspack was released on 10 March 2023 by ByteDance’s Web Infra team. It is a Rust‑based web build tool created to address severe performance bottlenecks in large internal applications, where Webpack builds could exceed ten minutes and sometimes half an hour. Optimizations on top of Webpack yielded limited gains, prompting a bottom‑up rewrite.

Features:

Extremely fast startup thanks to Rust.

Lightning‑quick HMR with incremental compilation.

Full compatibility with the Webpack ecosystem.

Out‑of‑the‑box support for TypeScript, JSX, CSS, CSS Modules, Sass, etc.

Default production optimizations such as tree‑shaking and code minification.

Framework‑agnostic design.

Github: https://github.com/web-infra-dev/rspack

Rsbuild

Rsbuild builds on Rspack as an enhanced CLI, offering a zero‑configuration experience and a migration path from Webpack to Rspack. It claims up to ten‑fold faster build speeds and a lighter dependency footprint.

Key capabilities:

Easy configuration – provides semantic configuration that lowers the learning curve for Rspack users.

Performance first – integrates Rust‑based tools Rspack and SWC, delivering 5–10× faster builds compared with Create React App or Vue CLI.

Plugin ecosystem – supports most Webpack plugins and all Rspack plugins, allowing reuse of existing plugin code.

Stable artifacts – ensures consistent development and production outputs, automatically applying syntax downgrades and polyfills.

Framework‑agnostic – works with React, Vue 3, Vue 2, Svelte, Solid, Lit and others.

Performance is comparable to native Rspack; the additional built‑in features cause a slight overhead.

Github: https://github.com/web-infra-dev/rsbuild

Rspress

Rspress is a static‑site generator built on Rspack that leverages React for fast rendering. It includes a ready‑made documentation theme, customizable theming, MDX authoring, built‑in full‑text search, and a simple i18n solution.

Highlighted features:

Ultra‑fast compilation via a Rust front‑end toolchain.

MDX content authoring – allows embedding React components in Markdown.

Automatic full‑text search index generation.

Built‑in i18n support.

Static HTML output for easy deployment.

Extensible theme and UI customization.

A performance comparison (Rspress vs. Docusaurus vs. Nextra) shows Rspress achieving higher compilation speed.

Github: https://github.com/web-infra-dev/rspress

Rsdoctor

Rsdoctor is a comprehensive diagnostic and analysis tool for Webpack and Rspack builds. It visualizes compilation steps and timing, and provides a Bundle Diff feature to prevent code regression.

Core features:

Compilation visualization – graphical display of build behavior and duration.

Multiple analysis capabilities – resource lists, module dependency graphs, loader/plugin/resolver analysis, built‑in rule checks such as duplicate package detection and ES version validation.

Custom rule support – users can add bespoke scanning rules based on Rsdoctor’s data.

Framework‑agnostic – works with any project built on Webpack or Rspack.

The overview page presents project configuration, diagnostics, compilation information, and artifact details.

Github: https://github.com/web-infra-dev/rsdoctor

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

TypeScriptJavaScriptRspackFrontend BuildRsbuildRslib
Full-Stack Cultivation Path
Written by

Full-Stack Cultivation Path

Focused on sharing practical tech content about TypeScript, Vue 3, front-end architecture, and source code analysis.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.