File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
website/docs/zh/guide/advanced Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Rslib 支持在代码中引用图片、字体、音频、视频等类型的静态资源。
4
4
5
- 在 [ format] ( /config/lib/format ) 为 ` cjs ` 或 ` esm ` 时,Rslib 将产物视为需要被其他打包工具再次消费的中间产物。
6
-
7
5
## 静态资源格式
8
6
9
7
以下是 Rslib 默认支持的静态资源格式:
@@ -38,7 +36,7 @@ console.log(logo); // "/static/logo.[hash].png"
38
36
export default = () => <img src = { logo } />;
39
37
```
40
38
41
- Rslib 会将源文件转化为一个 JS 文件和一个根据 [ output.distPath] ( /config/rsbuild/output#outputdistpath ) 输出的静态资源文件,用于保留对静态资源的 ` import ` 语句。
39
+ 在 [ format ] ( /config/lib/format ) 为 ` cjs ` 或 ` esm ` 时, Rslib 将产物视为会被其他打包工具再次消费的中间产物。Rslib 会在代码转换时将源文件转化为一个 JS 文件和一个根据 [ output.distPath] ( /config/rsbuild/output#outputdistpath ) 输出的静态资源文件,用于保留对静态资源的 ` import ` 语句。
42
40
43
41
下面是一个使用示例,假设源码如下:
44
42
@@ -125,7 +123,7 @@ export { logo_rslib_entry_namespaceObject as default };
125
123
}
126
124
```
127
125
128
- 在 [ format] ( /config/lib/format ) 为 ` cjs ` 或 ` esm ` 时,Rslib 将产物视为需要被其他打包工具再次消费的中间产物, 会通过设置 [ output.assetPrefix] ( /config/rsbuild/output#outputassetprefix ) 为 ` "auto" ` 来使 CSS 产物中保留相对引用路径。
126
+ 在 [ format] ( /config/lib/format ) 为 ` cjs ` 或 ` esm ` 时,Rslib 将产物视为会被其他打包工具再次消费的中间产物。Rslib 会通过设置 [ output.assetPrefix] ( /config/rsbuild/output#outputassetprefix ) 为 ` "auto" ` 来使 CSS 产物中保留相对引用路径。
129
127
130
128
下面是一个使用示例,假设源码如下:
131
129
You can’t perform that action at this time.
0 commit comments