Skip to content

Commit 2fcdaa4

Browse files
authored
docs: specify how to debug Rslib config (#1279)
1 parent 74e913b commit 2fcdaa4

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

website/docs/en/config/rsbuild/output.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ The `charset` config allows you to specify the [character encoding](https://deve
2323

2424
## output.cleanDistPath <RsbuildDocBadge path="/config/output/clean-dist-path" text="output.cleanDistPath" />
2525

26+
- **CLI:** `--clean` / `--no-clean`
27+
2628
Whether to clean up all files under the output directory before the build starts (the output directory defaults to `dist`).
2729

2830
## output.copy <RsbuildDocBadge path="/config/output/copy" text="output.copy" />
2931

30-
- **CLI:** `--clean` / `--no-clean`
31-
3232
Copies the specified file or directory to the dist directory, implemented based on [rspack.CopyRspackPlugin](https://rspack.rs/plugins/rspack/copy-rspack-plugin).
3333

3434
## output.cssModules <RsbuildDocBadge path="/config/output/css-modules" text="output.cssModules" />

website/docs/en/guide/basic/configure-rslib.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default {
6262
};
6363
```
6464

65-
Rslib will generate the [environments](https://rsbuild.rs/config/environments) configuration of Rsbuild internally, please refer to [Configuration Debug](#configuration-debug) to view the final generated configuration.
65+
Rslib will generate the [environments](https://rsbuild.rs/config/environments) configuration of Rsbuild internally, you can run [rslib inspect](/guide/basic/cli#rslib-inspect) command to view the final generated configuration.
6666

6767
You can also refer to the [Configuration Overview](/config/) page to view the detailed introduction of all configurations.
6868

@@ -203,15 +203,15 @@ Rslib is built on top of Rsbuild and Rsbuild supports directly modifying the Rsp
203203

204204
For more details, refer to [Configure Rspack](https://rsbuild.rs/guide/basic/configure-rspack).
205205

206-
## Configuration debug
206+
## Debug mode
207207

208-
You can enable Rslib's debug mode by adding the `DEBUG=rsbuild` environment variable when executing a build. It will display the final Rsbuild/Rspack configuration after processing by Rslib.
208+
You can add the `DEBUG=rsbuild` environment variable when building to enable Rslib's debug mode.
209209

210210
```bash
211211
DEBUG=rsbuild pnpm build
212212
```
213213

214-
In debug mode, Rslib will write the Rsbuild / Rspack config to the dist directory, which is convenient for developers to view and debug.
214+
In debug mode, Rslib will output additional log information and write the final Rsbuild config and Rspack config after processing by Rslib to the output directory, making it convenient for developers to view and debug.
215215

216216
Here is an example of a library that sets both CJS and ESM formats:
217217

@@ -222,9 +222,11 @@ Inspect config succeed, open following files to view the content:
222222
- Rsbuild Config (cjs): /project/dist/.rsbuild/rsbuild.config.cjs.mjs
223223
- Rspack Config (esm): /project/dist/.rsbuild/rspack.config.esm.mjs
224224
- Rspack Config (cjs): /project/dist/.rsbuild/rspack.config.cjs.mjs
225-
- Rslib Config: /project/dist/.rsbuild/rslib.config.mjs
226225
```
227226

228227
- Open the generated `/dist/.rsbuild/rsbuild.config.esm.mjs` file to see the complete content of the Rsbuild config.
229228
- Open the generated `/dist/.rsbuild/rspack.config.esm.mjs` file to see the complete content of the Rspack config.
230-
- Open the generated `/dist/.rsbuild/rslib.config.mjs` file to see the complete content of the Rslib config.
229+
230+
::: info
231+
If you want to view the normalized Rslib configuration, you need to run [rslib inspect](/guide/basic/cli#rslib-inspect) command.
232+
:::

website/docs/zh/guide/basic/configure-rslib.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default {
6262
};
6363
```
6464

65-
Rslib 会在内部生成 Rsbuild 的 [environments](https://rsbuild.rs/zh/config/environments) 配置,请参考 [调试配置](#调试配置) 来查看最终生成的配置
65+
Rslib 会在内部生成 Rsbuild 的 [environments](https://rsbuild.rs/zh/config/environments) 配置,可以运行 [rslib inspect](/guide/basic/cli#rslib-inspect) 命令来查看最终生成的配置
6666

6767
你也可以在 [配置概览](/config/) 页面查看所有配置的详细介绍。
6868

@@ -203,15 +203,15 @@ Rslib 基于 Rsbuild 构建,Rsbuild 支持直接修改 Rspack 配置对象,
203203

204204
详情请参考 [配置 Rspack](https://rsbuild.rs/guide/basic/configure-rspack)
205205

206-
## 调试配置
206+
## 调试模式
207207

208-
在执行构建时,你可以通过添加 `DEBUG=rsbuild` 环境变量来启用 Rslib 的调试模式,它会在 Rslib 处理后显示最终的 Rsbuild 和 Rspack 配置
208+
你可以在执行构建时添加 `DEBUG=rsbuild` 环境变量来开启 Rslib 的调试模式。
209209

210210
```bash
211211
DEBUG=rsbuild pnpm build
212212
```
213213

214-
在调试模式下,Rslib 会将 Rsbuild Rspack 配置写入到 `dist` 目录下,方便开发者查看和调试
214+
在调试模式下,Rslib 会输出一些额外的日志信息,并将内部经过 Rslib 处理最终生成的 Rsbuild 配置和 Rspack 配置写入到产物目录下,便于开发者查看和调试
215215

216216
以下是一个例子,这个库设置了 CJS 和 ESM 两种输出格式:
217217

@@ -222,9 +222,11 @@ Inspect config succeed, open following files to view the content:
222222
- Rsbuild Config (cjs): /project/dist/.rsbuild/rsbuild.config.cjs.mjs
223223
- Rspack Config (esm): /project/dist/.rsbuild/rspack.config.esm.mjs
224224
- Rspack Config (cjs): /project/dist/.rsbuild/rspack.config.cjs.mjs
225-
- Rslib Config: /project/dist/.rsbuild/rslib.config.mjs
226225
```
227226

228227
- 打开生成的 `/dist/.rsbuild/rsbuild.config.esm.mjs` 文件,即可查看 Rsbuild 配置的完整内容。
229228
- 打开生成的 `/dist/.rsbuild/rspack.config.esm.mjs` 文件,即可查看 Rspack 配置的完整内容。
230-
- 打开生成的 `/dist/.rsbuild/rslib.config.mjs` 文件,即可查看 Rslib 配置的完整内容。
229+
230+
::: info
231+
如果你想查看归一化后的 Rslib 配置,需要运行 [rslib inspect](/guide/basic/cli#rslib-inspect) 命令。
232+
:::

0 commit comments

Comments
 (0)