For AI agents: the complete documentation index is available at https://rspack.rs/llms.txt, the full documentation bundle is available at https://rspack.rs/llms-full.txt, and this page is available as Markdown at https://rspack.rs/api/index.md.
close

Introduction

Rspack provides a variety of APIs and command line interface (CLI) to customize the build process.

There are some features overlap between APIs and CLI, e.g. some configuration options may be available via CLI flags, while some others are only available through specific APIs.

The following concepts will help you get started.

CLI

The Command Line Interface (CLI) to configure and interact with your build process. For the most part, the CLI is used to kick off the process using a configuration file and a few flags (e.g. --env).

Learn more about the CLI →

Rspack runtime API

This section covers the module methods and variables supported by Rspack, along with the HMR APIs provided by the Rspack runtime. These APIs let applications update modules in the browser without reloading the page.

Learn more about the Rspack runtime API →

JavaScript API

While most users can get away with using the CLI along with a configuration file, more fine-grained control of the compilation can be achieved via the Node interface. This includes passing multiple configurations, programmatically running or watching, and collecting stats.

Learn more about the JavaScript API →

Loader API

Loaders are transformations that are applied to the source code of a module. They are written as functions that accept source code as a parameter and return a new version of that code with transformations applied.

Learn more about the loaders →

Plugin API

The plugin interface allows users to tap directly into the compilation process. Plugins can register handlers on lifecycle hooks that run at different points throughout a compilation. When each hook is executed, the plugin will have full access to the current state of the compilation.

Learn more about the plugins →