Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions website/docs/en/config/rsbuild/output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ The `charset` config allows you to specify the [character encoding](https://deve

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

- **CLI:** `--clean` / `--no-clean`

Whether to clean up all files under the output directory before the build starts (the output directory defaults to `dist`).

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

- **CLI:** `--clean` / `--no-clean`

Copies the specified file or directory to the dist directory, implemented based on [rspack.CopyRspackPlugin](https://rspack.rs/plugins/rspack/copy-rspack-plugin).

## output.cssModules <RsbuildDocBadge path="/config/output/css-modules" text="output.cssModules" />
Expand Down
14 changes: 8 additions & 6 deletions website/docs/en/guide/basic/configure-rslib.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
};
```

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.
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.

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

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

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

## Configuration debug
## Debug mode

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.
You can add the `DEBUG=rsbuild` environment variable when building to enable Rslib's debug mode.

```bash
DEBUG=rsbuild pnpm build
```

In debug mode, Rslib will write the Rsbuild / Rspack config to the dist directory, which is convenient for developers to view and debug.
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.

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

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

- Open the generated `/dist/.rsbuild/rsbuild.config.esm.mjs` file to see the complete content of the Rsbuild config.
- Open the generated `/dist/.rsbuild/rspack.config.esm.mjs` file to see the complete content of the Rspack config.
- Open the generated `/dist/.rsbuild/rslib.config.mjs` file to see the complete content of the Rslib config.

::: info
If you want to view the normalized Rslib configuration, you need to run [rslib inspect](/guide/basic/cli#rslib-inspect) command.
:::
14 changes: 8 additions & 6 deletions website/docs/zh/guide/basic/configure-rslib.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
};
```

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

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

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

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

## 调试配置
## 调试模式

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

```bash
DEBUG=rsbuild pnpm build
```

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

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

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

- 打开生成的 `/dist/.rsbuild/rsbuild.config.esm.mjs` 文件,即可查看 Rsbuild 配置的完整内容。
- 打开生成的 `/dist/.rsbuild/rspack.config.esm.mjs` 文件,即可查看 Rspack 配置的完整内容。
- 打开生成的 `/dist/.rsbuild/rslib.config.mjs` 文件,即可查看 Rslib 配置的完整内容。

::: info
如果你想查看归一化后的 Rslib 配置,需要运行 [rslib inspect](/guide/basic/cli#rslib-inspect) 命令。
:::
Loading