Skip to content

Commit

Permalink
docs: complete zh
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Feb 13, 2025
1 parent caa3e4f commit da99ad3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions website/docs/zh/guide/advanced/static-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Rslib 支持在代码中引用图片、字体、音频、视频等类型的静态资源。

[format](/config/lib/format)`cjs``esm` 时,Rslib 将产物视为需要被其他打包工具再次消费的中间产物。

## 静态资源格式

以下是 Rslib 默认支持的静态资源格式:
Expand Down Expand Up @@ -38,7 +36,7 @@ console.log(logo); // "/static/logo.[hash].png"
export default = () => <img src={logo} />;
```

Rslib 会将源文件转化为一个 JS 文件和一个根据 [output.distPath](/config/rsbuild/output#outputdistpath) 输出的静态资源文件,用于保留对静态资源的 `import` 语句。
[format](/config/lib/format)`cjs``esm` 时,Rslib 将产物视为会被其他打包工具再次消费的中间产物。Rslib 会在代码转换时将源文件转化为一个 JS 文件和一个根据 [output.distPath](/config/rsbuild/output#outputdistpath) 输出的静态资源文件,用于保留对静态资源的 `import` 语句。

下面是一个使用示例,假设源码如下:

Expand Down Expand Up @@ -125,7 +123,7 @@ export { logo_rslib_entry_namespaceObject as default };
}
```

[format](/config/lib/format)`cjs``esm` 时,Rslib 将产物视为需要被其他打包工具再次消费的中间产物,会通过设置 [output.assetPrefix](/config/rsbuild/output#outputassetprefix)`"auto"` 来使 CSS 产物中保留相对引用路径。
[format](/config/lib/format)`cjs``esm` 时,Rslib 将产物视为会被其他打包工具再次消费的中间产物。Rslib 会通过设置 [output.assetPrefix](/config/rsbuild/output#outputassetprefix)`"auto"` 来使 CSS 产物中保留相对引用路径。

下面是一个使用示例,假设源码如下:

Expand Down

0 comments on commit da99ad3

Please sign in to comment.