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
{/* Control whether to emit static assets such as images, fonts, audio, video, etc. */}
@@ -44,16 +62,24 @@ Whether to emit CSS to the output bundles.
44
62
45
63
At build time, prevent some `import` dependencies from being packed into bundles in your code, and instead fetch them externally at runtime.
46
64
65
+
In bundle mode, Rslib will automatically add the dependencies listed in the `dependencies`, `optionalDependencies`, and `peerDependencies` fields of `package.json` to `output.externals`. See [lib.autoExternal](/config/lib/auto-external) for more information.
66
+
67
+
:::note
47
68
It is important to note that `output.externals` differs from [resolve.alias](/config/rsbuild/resolve#resolvealias). Check out [resolve.alias](/config/rsbuild/resolve#resolvealias) documentation for more information.
@@ -78,10 +104,74 @@ Whether to generate a manifest file that contains information of all assets, and
78
104
79
105
Configure whether to enable code minification in production mode, or to configure minimizer options.
80
106
107
+
When `output.minify` is not specified, Rslib will use a sane default value.
108
+
109
+
- When format is `esm`, `cjs` and `umd`, only dead code elimination and unused code elimination will be performed. The default value is:
110
+
111
+
```ts
112
+
exportdefaultdefineConfig({
113
+
output: {
114
+
minify: {
115
+
js: true,
116
+
css: false,
117
+
jsOptions: {
118
+
minimizerOptions: {
119
+
mangle: false,
120
+
minify: false,
121
+
compress: {
122
+
defaults: false,
123
+
unused: true,
124
+
dead_code: true,
125
+
toplevel: true,
126
+
},
127
+
format: {
128
+
comments: 'some',
129
+
preserve_annotations: true,
130
+
},
131
+
},
132
+
},
133
+
},
134
+
},
135
+
});
136
+
```
137
+
138
+
- When format is `mf`, since MF assets are loaded over the network, which means they will not be compressed by the application project. Therefore, they need to be minified in Rslib. The default value is:
139
+
140
+
```ts
141
+
exportdefaultdefineConfig({
142
+
output: {
143
+
minify: {
144
+
js: true,
145
+
css: false,
146
+
jsOptions: {
147
+
minimizerOptions: {
148
+
mangle: false,
149
+
// Enable minification
150
+
minify: true,
151
+
compress: {
152
+
defaults: false,
153
+
unused: true,
154
+
dead_code: true,
155
+
// Avoid remoteEntry's global variable being tree-shaken
Specifies the range of target browsers that the project is compatible with.
84
172
173
+
Rslib will generate `output.overrideBrowserslist` based on [syntax](/config/lib/syntax), see [ESX_TO_BROWSERSLIST](https://github.com/web-infra-dev/rslib/blob/8d65f3728d60254bcf1a8e24d72902ad79dae959/packages/core/src/utils/syntax.ts#L42-L153) to get the mapping value.
Copy file name to clipboardExpand all lines: website/docs/en/config/rsbuild/source.mdx
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,13 +13,17 @@ Include additional files that should be treated as static assets.
13
13
14
14
Used to configure the decorators syntax.
15
15
16
+
If [experimentalDecorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) is enabled in `tsconfig.json`, Rslib will set `source.decorators.version` to `legacy` by default.
Replaces variables in your code with other values or expressions at compile time. This can be useful for allowing different behavior between development builds and production builds.
0 commit comments