Rspack

rspack.dev
Developer Tools

Rspack is a high performance JavaScript bundler written in Rust. It offers strong compatibility with the webpack ecosystem, and lightning fast build speeds.

llms.txt

Rspack

Fast Rust-based bundler for the web with a modernized webpack API

Guide

  • Introduction: Rspack Introduction guide covering Why Rspack?, Current status of Rspack, and Comparisons with other tools.
  • Quick start: Get up to speed quickly with a new Rspack based project
  • Ecosystem: Rstack is a unified JavaScript toolchain centered on Rspack, with high performance and consistent architecture
  • AI: This guide helps AI understand Rspack features, configuration, and best practices for more accurate development assistance.
  • Plugins: If loaders are the workhorse for file transformations, then plugins are the workhorse for the overall Rspack build process
  • Loader: Rspack has built-in support for JavaScript, CSS, JSON, and static assets modules
  • Dev server: @rspack/dev-server provides local development server support for Rspack CLI, including HMR and proxying.
  • Asset modules: Rspack has built-in support for assets (e.g. images, fonts, videos, etc.), which means you don't need any loader to process them
  • Asset base path: Rspack provides the output.publicPath option, which sets the base URL path prefix for bundled static assets (such as JS, CSS, images, etc.)
  • Module resolution: Module resolution is the process of converting a module identifier to a module's file path
  • Module Federation: Module Federation is an architectural pattern for JavaScript application decomposition (similar to microservices on the server-side), allowing you to share...
  • Web Workers: Rspack provides built-in support for Web Workers, which means you don't need any loader to use Web Workers directly
  • Lazy compilation: Lazy compilation is an effective strategy to improve the startup performance of the development phase
  • Builtin swc-loader: SWC (Speedy Web Compiler) is a transformer and minimizer for JavaScript and TypeScript based on Rust
  • Builtin lightningcss-loader: Lightning CSS is a high performance CSS parser, transformer and minifier written in Rust
  • ESM output: Rspack supports building with ESM format output. When building applications, Rspack generates IIFE-based bundled output by default instead of standard...
  • Layer: Layer is a powerful feature provided by Rspack that allows you to categorize and manage modules
  • TypeScript: Use TypeScript with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • CSS: Use CSS with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • HTML: Use HTML with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • JSON: Use JSON with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • React: Use React with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • React Server Components: Use React Server Components with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • Preact: Use Preact with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • Vue: Use Vue with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • Next.js: Use Next.js with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • Node.js: Use Rspack to build Node.js applications, covering runtime targets, external dependencies, development scripts, and native addons.
  • NestJS: Use NestJS with Rspack, including setup, TypeScript decorators, development HMR, and production minification.
  • Solid: Use Solid with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • Svelte: Use Svelte with Rspack, covering setup, configuration, integration details, and framework-specific development patterns.
  • Bundle analysis: Rsdoctor provides the Bundle Size module, which is mainly used to analyze the information of the outputs of Rspack, including the size of resources...
  • Code splitting: Rspack supports code splitting, letting you divide your code into separate chunks
  • Lazy barrel: Lazy barrel is a stable optimization feature in Rspack that improves build performance by skipping the building of unused re-export modules in...
  • Production optimization: Rspack supports code splitting, which allows splitting the code into other chunks
  • Build performance profile: This chapter introduces some common performance bottlenecks and performance profile methods for Rspack
  • Tree shaking: Rspack supports tree shaking, a term commonly used in the JavaScript ecosystem for removing unused code, also known as "dead code"
  • Use Rsdoctor: Rsdoctor is a build analyzer tailored for the Rspack ecosystem
  • Upgrading from v1 to v2: If you are using a Coding Agent that supports Skills, install the rspack-v2-upgrade skill to help with the upgrade process from v1 to v2
  • Upgrading from 0.x to v1: The document lists all breaking changes from Rspack 0.7 to 1.0
  • Migrate from webpack: Rspack's configuration is designed based on webpack, enabling you to migrate your project from webpack to Rspack with ease
  • Migrate from Create React App: Since Create React App (CRA) comes with rich built-in capabilities, it would be challenging to manually set up an equivalent configuration using Rspack CLI
  • Migrate from Storybook webpack: If you are using React / Vue with Storybook and building with webpack 5, you can replace the @storybook/react-webpack5 build with storybook-rsbuild, which...
  • Plugin compatibility: lists the compatibility status of common community plugins in Rspack
  • Branding guideline: Here you can find the branding guideline, assets and license for the project

Config

  • Configure Rspack: Rspack configuration overview covering core options, output behavior, optimization, development, and tooling settings.
  • Filename placeholders: Rspack's filename-related options support placeholders
  • Cache: Rspack caches snapshots and intermediate build artifacts, then reuses them in subsequent builds to improve build speed
  • Context: The context configuration is used to set the base directory for Rspack builds
  • DevServer: Configure @rspack/dev-server for local development and preview.
  • Devtool: Choose a style of source mapping to enhance the debugging process
  • Entry: Rspack entry configuration reference covering single and multiple entries, dynamic entry functions, and entry description options.
  • Experiments: In minor releases, Rspack may change the APIs of experimental features
  • Extends: Used to extend configurations from other files or packages
  • Externals: Externals specify which modules Rspack should not bundle, and instead read directly from implementations provided by the external environment.
  • Incremental: Whether to enable incremental build, which significantly speeds up rebuilds and HMR by only rebuilding the changed parts
  • InfrastructureLogging: Options for infrastructure level logging. Generally used for logs unrelated to the Compilation
  • LazyCompilation: Lazy Compilation is an optimization technique that delays the compilation of modules until they are actually requested
  • Mode: The mode configuration is used to set the build mode of Rspack to enable the default optimization strategy
  • Module: Used to decide how to handle different types of modules in a project
  • Module generator: Configure generator options by module type.
  • Module parser: Configure parser options by module type.
  • Module rules: module.rules defines how Rspack processes different types of modules during the build
  • Node: The following Node.js options configure whether to polyfill or mock certain Node.js globals
  • Optimization: Use optimization config to custom optimization strategy
  • Output: The top-level output key contains a set of options instructing Rspack on how and where it should output your bundles, assets, and anything else you bundle...
  • Performance: performance configures Rspack's performance hint mechanism, helping you identify oversized outputs during the build
  • Plugins: The plugins option is used to register a set of Rspack or webpack plugins to customize the build process
  • Resolve: Used to configure the Rspack module resolution logic
  • ResolveLoader: This configuration item is consistent in type with resolve, but this setting only affects the resolution of loaders
  • Stats: Generate packaging information that can be used to analyze module dependencies and optimize compilation speed
  • Target: Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code
  • Watch: Rspack can watch files and recompile whenever they change
  • Other options: These are the remaining configuration options supported by rspack
  • Deprecated options: lists configuration options that have been deprecated in Rspack

Plugin

  • Rspack plugins: Overview of Rspack plugin docs, including built-in plugins, webpack-compatible plugins, and reference entry points.
  • CircularDependencyRspackPlugin: Detects circular import dependencies between modules that will exist at runtime
  • CopyRspackPlugin: Copies individual files or entire directories, which already exist, to the build directory
  • CssChunkingPlugin: CssChunkingPlugin is a plugin specifically designed for CSS code splitting
  • CssExtractRspackPlugin: Rspack is currently incompatible with mini-css-extract-plugin, but you can use the CssExtractRspackPlugin as a replacement
  • HtmlRspackPlugin: rspack.HtmlRspackPlugin is a high-performance HTML plugin implemented in Rust
  • LightningCssMinimizerRspackPlugin: This plugin uses lightningcss to minify CSS assets
  • SubresourceIntegrityPlugin: The rspack.SubresourceIntegrityPlugin is a plugin for enabling Subresource Integrity in Rspack
  • SwcJsMinimizerRspackPlugin: This plugin is used to minify JavaScript files using SWC
  • VirtualModulesPlugin: VirtualModulesPlugin allows you to create, modify, and delete files in memory, and Rspack treats these virtual files as if they were real files existing in...
  • Overview: Overview of webpack-compatible plugins in Rspack, with reference pages for supported plugins and integration details.
  • BannerPlugin: Adds a banner to the top or bottom of each generated chunk
  • ContextReplacementPlugin: Context refers to a require or dynamic import() with an expression such as require('./locale/' + name + '.json')
  • DefinePlugin: The DefinePlugin replaces variables in your code with other values or expressions at compile time
  • DeterministicModuleIdsPlugin: Assign short numeric module ids that stay stable between compilations
  • DllPlugin: The DllPlugin is used in a separate rspack configuration exclusively to create a dll-only-bundle
  • DllReferencePlugin: The DllReferencePlugin is used to reference the dll-only-bundle to require pre-built dependencies
  • ElectronTargetPlugin: This plugin is used to external the Electron built-in modules during bundling, and is used by externalsPresets.electron, externalsPresets.electronMain...
  • EnableChunkLoadingPlugin: Enable runtime module bundling for this chunkLoadingType, and is used by output.enabledChunkLoadingTypes under the hood
  • EnableLibraryPlugin: Enable library format bundling for this libraryType, and is used by output.enabledLibraryTypes under the hood
  • EnableWasmLoadingPlugin: Enable runtime module bundling for this wasmLoadingType, and is used by output.enabledWasmLoadingTypes under the hood
  • EntryPlugin: Adds an entry chunk on compilation. The chunk is named options.name and contains only one module (plus dependencies)
  • EnvironmentPlugin: The EnvironmentPlugin is shorthand for using the DefinePlugin on process.env keys
  • EvalSourceMapDevToolPlugin: This plugin enables more fine grained control of source map generation
  • ExternalsPlugin: This plugin allows you to specify external dependencies that should not be bundled into the output files
  • HotModuleReplacementPlugin: Enabling HMR is straightforward and in most cases no options are necessary
  • IgnorePlugin: This plugin will prevent the generation of modules for import or require calls matching the regular expressions
  • JsonpTemplatePlugin: This plugin is used to bundle browser assets, often used with childCompiler.
  • JavascriptModulesPlugin: Handles the bundling of JavaScript, usually used to access the hooks of the JavascriptModulesPlugin:
  • LimitChunkCountPlugin: While writing your code, you may have already added many code split points to load stuff on demand
  • ModuleFederationPlugin: ModuleFederationPlugin enables Module Federation in Rspack
  • ModuleFederationPluginV1: This plugin corresponds to Module Federation v1.0, which is the ModuleFederationPlugin in webpack
  • NoEmitOnErrorsPlugin: This plugin is used to prevent the assets emitting when there are compilation errors
  • NodeTargetPlugin: This plugin is used to external the Node.js built-in modules during bundling, and is used by externalsPresets.node under the hood
  • NodeTemplatePlugin: This plugin is used to bundle out Node.js assets, often used with childCompiler
  • WebWorkerTemplatePlugin: This plugin is used to bundle Web Worker assets, often used with childCompiler.
  • NormalModuleReplacementPlugin: The NormalModuleReplacementPlugin allows you to replace resources that match resourceRegExp with newResource
  • ProgressPlugin: This plugin can be used to configure the progress bar
  • ProvidePlugin: Automatically load modules instead of having to import or require them everywhere
  • RuntimeChunkPlugin: Used to control how the runtime chunk is generated, it is used by optimization.runtimeChunk under the hood
  • SourceMapDevToolPlugin: This plugin enables more fine grained control of source map generation
  • SplitChunksPlugin: SplitChunksPlugin is a built-in plugin that splits code into multiple chunks to optimize application loading performance and achieve better caching...
  • CaseSensitivePlugin: Detect case sensitivity conflicts in referenced module names and emit warnings
  • Internal plugins: list of plugins used internally by Rspack, aligned with the plugins used internally by webpack
  • TreeShakingSharedPlugin: Rspack TreeShakingSharedPlugin plugin reference covering its purpose, available options, and common integration patterns.

API

  • Introduction: Rspack API overview covering the CLI, JavaScript API, Loader API, Plugin API, and runtime capabilities.
  • Command line interface: @rspack/cli is the command line tool for Rspack, providing a variety of commands to make working with Rspack easier
  • Module methods: This section covers all methods available in code compiled with Rspack
  • Module variables: This section covers all variables available in code compiled with Rspack
  • Hot module replacement: Rspack provides the same interface as webpack for implementing HMR
  • JavaScript API: Rspack JavaScript API overview covering compiler creation, watch mode, stats access, and programmatic build workflows.
  • Compiler: The Compiler is a core object in Rspack. A Compiler instance is created when you call Rspack's JavaScript API or CLI
  • Compilation: The Compilation object is one of the core objects used in the Rspack build process
  • Stats: The stats object that is passed as a second argument of the rspack() callback, is a good source of information about the code compilation process
  • Stats JSON: While using Rspack, you can use the following command to generate a JSON file of the statistics module information to analyze the module dependency...
  • Logger: Logging output is an additional way to display messages to the end users
  • Cache: When writing Rspack plugins, you can use compiler.getCache(name: string) or compilation.getCache(name: string) to get the cache object which can share data...
  • SWC API: Rspack uses SWC under the hood to transform and minify JavaScript code, and experimentally exposes some SWC JavaScript APIs through rspack.experiments.swc
  • Resolver API: Rspack uses the higher-performance rspack-resolver written in Rust to replace webpack's enhanced-resolve, and experimentally re-exports these APIs through...
  • Browser API: @rspack/browser is a version of Rspack specifically designed for browser environments, without relying on WebContainers or any particular platform
  • Overview: Rspack Loader API overview covering loader context, inline syntax, and writing custom loaders for module transforms.
  • Writing loaders: Learn how to create custom loaders for Rspack to transform files
  • Loader context: The loader context represents the properties that are available inside of a loader assigned to the this property
  • Inline loaders: It's possible to specify loaders in an import statement, or any equivalent "importing" method
  • Inline matchResource: Inline matchResource allows you to dynamically change the matching rules when loading resources
  • Overview: Rspack plugin API overview covering hook categories, compatibility status, and patterns for writing compatible plugins.
  • Compiler hooks: Compiler hooks allow Rspack plugins to intervene at specific stages of the build process
  • Compilation hooks: Compilation hooks are the primary extension method for Rspack plugins
  • NormalModuleFactory: NormalModuleFactory is used by the Compiler to generate modules (NormalModule)
  • ContextModuleFactory: The ContextModuleFactory module is used by the Compiler to generate dependencies from require.context API
  • JavascriptModulesPlugin: Called when computing the chunk hash for JavaScript chunks
  • Stats hooks: A HookMap, called when generating the specified stats item
  • RuntimePlugin hooks: RuntimePlugin is used to generate the code for the Rspack startup

Blog

  • Rspack blogs: Rspack blog archive covering release announcements, ecosystem updates, and technical articles from the team.
  • Announcing Rspack 2.0: Rspack 2.0 is out! It introduces more modern defaults, API design, and build outputs while remaining compatible with the webpack ecosystem.
  • Announcing Rspack 1.7: Rspack 1.7 has been released, improving SWC Wasm plugin compatibility, importing assets as bytes, and stabilizing multiple experimental features.
  • Announcing Rspack 1.6: Rspack 1.6 has been released with better ESM output, enhanced tree shaking, support for the import defer syntax, stabilized layers feature, and default barrel file optimization.
  • Announcing Rspack 1.5: Rspack 1.5 has been released, introducing barrel file optimization and constant inlining optimization, also adding a built-in file system watcher, a virtual modules plugin, and a Rust extension mechanism, while dropping support for Node.js 16.
  • Announcing Rspack 1.4: Rspack 1.4 has been released with support for running in the browser, incremental builds enabled by default, faster SWC, smaller bundles, and new features including the CssChunkingPlugin.
  • Rspack joins the Next.js ecosystem: Today, we’re excited to introduce next-rspack, a community-driven plugin bringing direct Rspack support to Next.js. This integration offers a fast, webpack-compatible alternative for teams not yet ready to adopt Turbopack.
  • Announcing Rspack 1.3: Rspack 1.3 has been released with support for detecting circular dependencies, building HTTP imports, and referencing AMD modules. It introduces a new lazy compilation middleware, while also improving code splitting performance, output bundle size, and memory usage.
  • Announcing Rspack 1.2: Rspack 1.2 has been released, introducing experimental persistent caching, a faster code splitting algorithm, and Yarn PnP support.
  • Announcing Rspack 1.1: Rspack and Rsbuild 1.1 has been released, significantly improve the performance of cold starts and incremental builds. It also improve the built-in HTML plugin and types of configuration options.
  • Announcing Rspack 1.0: Today Rspack has reached a new milestone - 1.0. This means that Rspack is production-ready, covers most of webpack's APIs and features, and is now prepared to support more users.
  • Announcing Rspack 1.0 alpha: Rspack 1.0 alpha is now available on npm! Before releasing Rspack 1.0 stable version, we will test for 1~2 months to improve the API stability and reliability of v1.0 and to verify its impact on downstream projects.
  • Announcing Rspack 0.7: Rspack 0.7 has been released, featuring support for lazy compilation, which can significantly improve the dev startup performance of large applications. It also introduces a brand-new css-module-lexer, increasing CSS bundling speed by 4 times.
  • Announcing Rspack 0.6: Rspack 0.6 is out, with built-in support for mini-css-extract-plugin and new tree-shaking enabled by default.
  • Announcing Rspack 0.5: Rspack 0.5 is out, supporting Module Federation and removing the default SWC transformation.
  • Module Federation added to Rspack: The latest Rspack 0.5.0 introduces the highly anticipated Module Federation, which is detailed in this article.
  • Announcing Rspack 0.4: Rspack 0.4 is out, removing support for some builtin features.
  • Announcing Rspack 0.3: Rspack 0.3 is out, adding support for web workers and the builtin:swc-loader.
  • Announcing Rspack 0.2: Rspack 0.2 is out, introducing many new features, such as support for realContentHash, DataURI, and the ESM format, and more.
  • Announcing Rspack 0.1: Rspack has officially been released!

Others

  • Builtin plugin: Builtin plugin introduction
  • Rspack loader: The old architecture is a quite simple version, which only supports loaders for normal stage
  • Building: Please see prerequisites for setting up Rust and Node.js
  • Debugging: Simply set breakpoints in the specified Rust code and start Debug Rspack to begin debugging
  • Prerequisites: Rspack is built using Rust and NAPI-RS, then released as Node.js packages
  • Profiling: In this section, we'll explore how to profile Rspack for identifying bottlenecks
  • Project architecture: monorepo containing both Rust crates and JavaScript packages:
  • Releasing: Rspack releases are automated through GitHub Actions
  • Testing: Because Rspack uses a mix of Rust and Node.js code, different testing strategies are used for each
  • Tracing: tracing is used to record the internal processes of Rspack compilation, which can be used for performance analysis as well as narrow down the location of a bug
  • Contributing guide: Rspack contributor docs overview covering project architecture, development workflow, testing, debugging, and releases.
  • SWC plugin version mismatch: The SWC plugin is still an experimental feature, and the SWC Wasm plugin is currently not backward compatible
  • License: Unless otherwise noted, the content of the documents is from Rspack website contributors and is licensed under the CC BY 4.0 license
  • FAQ: Common Rspack questions covering webpack compatibility, performance tradeoffs, plugins, loaders, and framework support.
  • Glossary: Glossary of Rspack terms covering bundler concepts, architecture, commonly used APIs, and project vocabulary.
  • Future behavior: During the 0.y.z phase, Rspack may include breaking changes only when upgrading the minor (y) version, and ensures backward compatibility when upgrading the...
  • Roadmap: This document outlines the current direction of Rspack and will continue to evolve alongside future releases. Last updated: 2026-04
  • Core team: The development of Rstack is led by ByteDance's web infra team and driven together with community contributors on several core projects, including Rspack...
  • Emeriti members: We'd like to recognize a few people who have made significant contributions to Rspack and its ecosystem in the past and have helped maintain them over the years
  • Join us: We are the Web Infra team at ByteDance, serving the entire company's Web ecosystem
Related

The AI Toolkit for TypeScript, from the creators of Next.js.

/llms.txt
136,985 tokens
Developer Tools

Meet the modern standard for public facing documentation. Beautiful out of the box, easy to maintain, and optimized for user engagement.

/llms.txt
5,436 tokens
/llms-full.txt
181,290 tokens
Developer Tools

Web development for the rest of us.

/llms.txt
602 tokens
/llms-full.txt
453,623 tokens
Developer Tools

Search through billions of items for similar matches to any object, in milliseconds. It’s the next generation of search, an API call away.

/llms.txt
15,715 tokens
/llms-full.txt
588,629 tokens
Developer Tools

Build and deploy reliable background jobs with no timeouts and no infrastructure to manage.

/llms.txt
12,202 tokens
/llms-full.txt
387,586 tokens
Developer Tools

Get the simple developer experience of SQLite in production, and scale your multi-tenant backend with unlimited databases.

/llms.txt
10,006 tokens
/llms-full.txt
163,317 tokens
Developer Tools

Upstash is a serverless data platform providing low latency and high scalability for real-time applications.

/llms.txt
52,307 tokens
/llms-full.txt
1,200,134 tokens
Developer Tools

One-click deployments built for teams, tuned for Laravel, loaded with tools and goodies you're going to love.

/llms.txt
565 tokens
/llms-full.txt
11,330 tokens
Developer Tools