Skip to content

Commit 9fff7ec

Browse files
committed
docs: complete build command guide
1 parent 64866c5 commit 9fff7ec

4 files changed

Lines changed: 82 additions & 6 deletions

File tree

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
11
# build
22

3-
TODO.
3+
The `rs build` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-build) to build an application for production.
4+
5+
## Usage
6+
7+
```bash
8+
rs build [options]
9+
```
10+
11+
The command loads the application configuration registered with [`define.app()`](../configuration#define-app).
12+
13+
## Options
14+
15+
`rs build` supports the same build options as Rsbuild. See the [Rsbuild CLI documentation](https://rsbuild.rs/guide/basic/cli#rsbuild-build) for details.
16+
17+
Examples:
18+
19+
```bash
20+
# Write output files to the output directory
21+
rs build --dist-path output
22+
23+
# Generate source maps for the output files
24+
rs build --source-map
25+
26+
# Rebuild when files change
27+
rs build --watch
28+
```
429

530
## Configuration
631

7-
See [`define.app()`](../configuration#define-app).
32+
Configure the production build through [`define.app()`](../configuration#define-app) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
33+
34+
```ts title="rstack.config.ts"
35+
import { define } from 'rstack';
36+
37+
define.app({
38+
output: {
39+
distPath: {
40+
root: 'output',
41+
},
42+
sourceMap: true,
43+
},
44+
});
45+
```

website/docs/en/guide/cli/dev.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The `rs dev` command starts the [Rsbuild development server](https://rsbuild.rs/
88
rs dev [options]
99
```
1010

11-
The command loads the application configuration registered with [`define.app()`](../configuration#define-app). When the Rstack configuration file or one of its imported dependencies changes, Rstack automatically restarts the development server and applies the updated configuration.
11+
The command loads the application configuration registered with [`define.app()`](../configuration#define-app).
1212

1313
## Options
1414

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
11
# build
22

3-
TODO.
3+
`rs build` 命令使用 [Rsbuild](https://rsbuild.rs/zh/guide/basic/cli#rsbuild-build) 构建应用的生产版本。
4+
5+
## 用法 \{#usage}
6+
7+
```bash
8+
rs build [options]
9+
```
10+
11+
该命令会加载通过 [`define.app()`](../configuration#define-app) 注册的应用配置。
12+
13+
## 选项 \{#options}
14+
15+
`rs build` 支持与 Rsbuild 相同的构建选项,具体说明请参见 [Rsbuild CLI 文档](https://rsbuild.rs/zh/guide/basic/cli#rsbuild-build)
16+
17+
示例:
18+
19+
```bash
20+
# 将构建产物写入 output 目录
21+
rs build --dist-path output
22+
23+
# 为构建产物生成 source map
24+
rs build --source-map
25+
26+
# 在文件变化时重新构建
27+
rs build --watch
28+
```
429

530
## 配置 \{#configuration}
631

7-
参见 [`define.app()`](../configuration#define-app)
32+
[Rstack 配置文件](/guide/configuration#configuration-file)中通过 [`define.app()`](../configuration#define-app) 配置生产构建。该 API 支持标准的 [Rsbuild 配置](https://rsbuild.rs/zh/config/)
33+
34+
```ts title="rstack.config.ts"
35+
import { define } from 'rstack';
36+
37+
define.app({
38+
output: {
39+
distPath: {
40+
root: 'output',
41+
},
42+
sourceMap: true,
43+
},
44+
});
45+
```

website/docs/zh/guide/cli/dev.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
rs dev [options]
99
```
1010

11-
该命令会加载通过 [`define.app()`](../configuration#define-app) 注册的应用配置。当 Rstack 配置文件或其导入的任一依赖发生变化时,Rstack 会自动重启开发服务器并应用更新后的配置。
11+
该命令会加载通过 [`define.app()`](../configuration#define-app) 注册的应用配置。
1212

1313
## 选项 \{#options}
1414

0 commit comments

Comments
 (0)