# @rspack/dev-server

> Development server for Rspack

Latest version **2.2.1** (published 2026-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rspack/dev-server
pnpm add @rspack/dev-server
yarn add @rspack/dev-server
bun add @rspack/dev-server
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2026-08-22 |
| First published | 2022-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^20.19.0 \|\| >=22.12.0 |
| Dependencies | 1 |
| Unpacked size | 930.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Maintainers | hardfist3, chenjiahan |

## Links

- npm: https://www.npmjs.com/package/@rspack/dev-server
- Repository: https://github.com/rstackjs/rspack-dev-server
- Issues: https://github.com/rstackjs/rspack-dev-server/issues
- npm.io page: https://npm.io/package/@rspack/dev-server

## Dependencies (1)

- [@rspack/dev-middleware](https://npm.io/package/@rspack/dev-middleware.md) ^2.0.3

## Recent versions

- 2.2.1 (latest) — 2026-08-22
- 2.0.0-rc.3 (rc) — 2026-04-15
- 2.0.0-beta.7 (beta) — 2026-03-16
- 0.7.6-canary-fd6c40d-20240918093542 (canary) — 2024-09-18
- 1.0.0-alpha.5 (alpha) — 2024-07-17
- 0.7.6-canary-f272bd8-20240625122346 (nightly) — 2024-06-25
- 0.0.0-canary-2d5264852-20230525090643 (snapshot) — 2023-05-25
- 2.2.0 — 2026-08-03
- 2.1.0 — 2026-06-22
- 2.0.3 — 2026-05-29
- 2.0.2 — 2026-05-28
- 2.0.1 — 2026-04-25
- 2.0.0 — 2026-04-19
- 2.0.0-rc.2 — 2026-04-02
- 2.0.0-rc.1 — 2026-04-01
- … 1099 more at https://npm.io/package/@rspack/dev-server/versions

## README

# @rspack/dev-server

<p>
  <a href="https://npmjs.com/package/@rspack/dev-server?activeTab=readme"><img src="https://img.shields.io/npm/v/@rspack/dev-server?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" /></a>
  <a href="https://npmcharts.com/compare/@rspack/dev-server?minimal=true"><img src="https://img.shields.io/npm/dm/@rspack/dev-server.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
  <a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/@rspack/dev-server.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="node version"></a>
  <a href="https://github.com/rstackjs/rspack-dev-server/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" /></a>
</p>

Use Rspack with a development server that provides live reloading. This should be used for development only.

## Versions

- `2.x`: For Rspack v2, see [v1 -> v2](./docs/migrate-v1-to-v2.md) for migration guide.
- `1.x`: For Rspack v1, see [v1.x - README](https://github.com/rstackjs/rspack-dev-server/tree/v1.x#rspackdev-server) for usage guide.

## Installation

First of all, install `@rspack/dev-server` and `@rspack/core` by your favorite package manager:

```bash
# npm
$ npm install -D @rspack/dev-server @rspack/core

# yarn
$ yarn add -D @rspack/dev-server @rspack/core

# pnpm
$ pnpm add -D @rspack/dev-server @rspack/core

# bun
$ bun add -D @rspack/dev-server @rspack/core
```

## Usage

There are two recommended ways to use `@rspack/dev-server`:

### With the CLI

The easiest way to use it is with the [`@rspack/cli`](https://www.npmjs.com/package/@rspack/cli).

You can install it in your project by:

```bash
# npm
$ npm install -D @rspack/cli

# yarn
$ yarn add -D @rspack/cli

# pnpm
$ pnpm add -D @rspack/cli

# bun
$ bun add -D @rspack/cli
```

And then start the development server by:

```bash
# with rspack.config.js
$ rspack serve

# with custom config file
$ rspack serve -c ./your.config.js
```

> See [CLI](https://rspack.rs/api/cli) for more details.

While starting the development server, you can specify the configuration by the `devServer` field of your Rspack config file:

```js
// rspack.config.mjs
export default {
  devServer: {
    // the configuration of the development server
    port: 8080,
  },
};
```

> See [Rspack - devServer](https://rspack.rs/config/dev-server) for all configuration options.

### With the API

While it's recommended to run `@rspack/dev-server` via the CLI, you may also choose to start a server via the API.

```js
import { RspackDevServer } from '@rspack/dev-server';
import { rspack } from '@rspack/core';
import config from './rspack.config.mjs';

const compiler = rspack(config);
const devServerOptions = {
  ...config.devServer,
  // override
  port: 8888,
};

const server = new RspackDevServer(devServerOptions, compiler);

server.startCallback(() => {
  console.log('Successfully started server on http://localhost:8888');
});
```

## Credits

This repository is forked from [webpack-dev-server](https://github.com/webpack/webpack-dev-server). It adapts the original implementation for the Rspack ecosystem, bridging behavioral differences with webpack while adding Rspack-specific capabilities.

> Thanks to the [webpack-dev-server](https://github.com/webpack/webpack-dev-server) maintainers and its original creator, [@sokra](https://github.com/sokra).

## License

[MIT licensed](https://github.com/rstackjs/rspack-dev-server/blob/main/LICENSE).

---
_Source: https://npm.io/package/@rspack/dev-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
