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 22
33Rslib 支持在代码中引用图片、字体、音频、视频等类型的静态资源。
44
5- 在 [ format] ( /config/lib/format ) 为 ` cjs ` 或 ` esm ` 时,Rslib 将产物视为需要被其他打包工具再次消费的中间产物。
6-
75## 静态资源格式
86
97以下是 Rslib 默认支持的静态资源格式:
@@ -38,7 +36,7 @@ console.log(logo); // "/static/logo.[hash].png"
3836export default = () => <img src = { logo } />;
3937```
4038
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 ` 语句。
4240
4341下面是一个使用示例,假设源码如下:
4442
@@ -125,7 +123,7 @@ export { logo_rslib_entry_namespaceObject as default };
125123}
126124```
127125
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 产物中保留相对引用路径。
129127
130128下面是一个使用示例,假设源码如下:
131129
You can’t perform that action at this time.
0 commit comments