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
Set the directory of the dist files. Rsbuild will output files to the corresponding subdirectory according to the file type.
41
+
Set the directory of the output files. Rsbuild will emit files to the specified subdirectory according to the file type.
42
42
43
-
Detail:
43
+
> See [Output files](/guide/basic/output-files) for more information.
44
+
45
+
## File types
46
+
47
+
`output.distPath` can be set differently for different file types.
48
+
49
+
Here are the details of each `output.distPath` option:
44
50
45
51
-`root`: The root directory of all output files.
46
52
-`html`: The output directory of HTML files.
@@ -55,19 +61,19 @@ Detail:
55
61
-`media`: The output directory of media assets, such as videos.
56
62
-`assets`: The output directory of other static assets. Such as the assets defined in [Extend Asset Types](/guide/basic/static-assets#extend-asset-types).
57
63
58
-
###Root directory
64
+
## Root directory
59
65
60
66
The `root` is the root directory of the build artifacts and can be specified as a relative or absolute path. If the value of `root` is a relative path, it will be appended to the project's root directory to form an absolute path.
61
67
62
68
Other directories can only be specified as relative paths and will be output relative to the `root` directory.
63
69
64
-
###Example
70
+
## Example
65
71
66
72
The JavaScript files will be output to the `distPath.root` + `distPath.js` directory, which is `dist/static/js`.
67
73
68
74
To output JavaScript files to the `build/resource/js` directory, add the following config:
69
75
70
-
```js
76
+
```ts title="rsbuild.config.ts"
71
77
exportdefault {
72
78
output: {
73
79
distPath: {
@@ -77,3 +83,13 @@ export default {
77
83
},
78
84
};
79
85
```
86
+
87
+
The above config will generate the following directory structure:
Copy file name to clipboardExpand all lines: website/docs/en/config/output/filename.mdx
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,11 +43,15 @@ const prodDefaultFilename = {
43
43
};
44
44
```
45
45
46
-
Sets the filename of dist files.
46
+
Sets the filename of output files.
47
47
48
48
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.
49
49
50
-
The following are the details of each filename:
50
+
## File types
51
+
52
+
`output.filename` can be set differently for different file types.
53
+
54
+
Here are the details of each `output.filename` option:
51
55
52
56
-`html`: The name of the HTML files.
53
57
-`js`: The name of the JavaScript files.
@@ -58,7 +62,7 @@ The following are the details of each filename:
58
62
-`media`: The name of media assets, such as video.
59
63
-`assets`: The name of other static assets. Such as the assets defined in [Extend Asset Types](/guide/basic/static-assets#extend-asset-types).
60
64
61
-
> See [Output Files](/guide/basic/output-files) for more information.
65
+
> See [Output files](/guide/basic/output-files) for more information.
0 commit comments