You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importurlfrom'./assets/logo.svg'; // source code of './src/foo.ts' ↓
231
+
importurlfrom'./assets/logo.mjs'; // expected output of './dist/foo.mjs'
202
232
```
203
233
234
+
::: note
235
+
236
+
The way to import static assets in a JavaScript file and the corresponding output structure, please see [Import static assets](/guide/advanced/static-assets#import-assets-in-javascript-file).
237
+
238
+
:::
239
+
204
240
## redirect.dts
205
241
206
242
Controls the redirect of the import paths of output TypeScript declaration files.
Copy file name to clipboardExpand all lines: website/docs/en/guide/faq/features.mdx
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,41 @@ export default defineConfig({
35
35
});
36
36
```
37
37
38
+
## Static assets processing
39
+
40
+
### How to skip the processing of static asset files in bundleless mode?
41
+
42
+
In bundleless mode, Rslib transforms the source static asset file into a JavaScript file and a static asset file that is emitted according to [output.distPath](/config/rsbuild/output#outputdistpath) by default with preserving the `import` or `require` statements for static assets. To skip the above processing of static asset files, you need to:
43
+
44
+
1. Set `source.entry` to remove static asset files from the entry.
45
+
2. Set `output.copy` to copy static asset files to the output directory.
46
+
3. Set `redirect.asset.extension` to `false` to disable the redirect behavior for the import path of static asset files.
47
+
48
+
Below is an example of skipping the `.png` file processing. All `.png` files in `src` will be copied to the output directory and retained with consistent relative paths.
0 commit comments