Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve filename configuration #4719

Merged
merged 1 commit into from
Mar 6, 2025
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
9 changes: 7 additions & 2 deletions website/docs/en/config/output/filename.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ Sets the filename of output files.

After the production build, Rsbuild will add a hash in the middle of the filename by default. If you don't need to add it, you can set [output.filenameHash](/config/output/filename-hash) to `false` to disable this behavior.

:::tip
Rsbuild will generate the final file path based on `output.filename` and [output.distPath](/config/output/dist-path).

See [Output files](/guide/basic/output-files) for more information.

:::

## File types

`output.filename` can be set differently for different file types.
Expand All @@ -62,8 +69,6 @@ Here are the details of each `output.filename` option:
- `media`: The name of media assets, such as video.
- `assets`: The name of other static assets. Such as the assets defined in [Extend Asset Types](/guide/basic/static-assets#extend-asset-types).

> See [Output files](/guide/basic/output-files) for more information.

## Example

To set the name of the JavaScript files to `[name]_script.js`:
Expand Down
9 changes: 7 additions & 2 deletions website/docs/zh/config/output/filename.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ const prodDefaultFilename = {

在生产模式构建后,Rsbuild 会自动在文件名中间添加 hash 值,如果不需要添加,可以将 [output.filenameHash](/config/output/filename-hash) 设置为 `false` 来禁用该行为。

:::tip
Rsbuild 会基于 `output.filename` 和 [output.distPath](/config/output/dist-path) 来生成最终的文件路径。

查看 [构建产物目录](/guide/basic/output-files) 了解更多。

:::

## 文件类型

`output.filename` 可以为不同类型的文件设置不同的名称。
Expand All @@ -62,8 +69,6 @@ const prodDefaultFilename = {
- `media`:视频等媒体资源的名称。
- `assets`:其他静态资源的名称。例如 [扩展静态资源类型](/guide/basic/static-assets#扩展静态资源类型) 中定义的资源。

> 查看 [构建产物目录](/guide/basic/output-files) 了解更多。

## 示例

修改 JavaScript 文件的名称为 `[name]_script.js`:
Expand Down
Loading