@rsbuild/core 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/dist/1~rslib-runtime.js +8 -5
- package/dist/{753.js → 756.js} +157 -128
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/http-proxy-middleware.js +2 -5
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +7 -7
- package/dist/memfs.js +5 -5
- package/dist/ws.js +45 -31
- package/dist-types/build.d.ts +1 -1
- package/dist-types/cli/init.d.ts +1 -1
- package/dist-types/configChain.d.ts +59 -118
- package/dist-types/constants.d.ts +35 -31
- package/dist-types/createContext.d.ts +1 -2
- package/dist-types/createRsbuild.d.ts +1 -2
- package/dist-types/defaultConfig.d.ts +2 -4
- package/dist-types/helpers/exitHook.d.ts +1 -1
- package/dist-types/helpers/format.d.ts +2 -1
- package/dist-types/helpers/fs.d.ts +2 -4
- package/dist-types/helpers/index.d.ts +1 -2
- package/dist-types/helpers/packageJson.d.ts +1 -1
- package/dist-types/helpers/path.d.ts +4 -8
- package/dist-types/helpers/stats.d.ts +3 -5
- package/dist-types/helpers/url.d.ts +1 -0
- package/dist-types/helpers/vendors.d.ts +2 -3
- package/dist-types/helpers/version.d.ts +2 -3
- package/dist-types/hooks.d.ts +6 -8
- package/dist-types/index.d.ts +10 -5
- package/dist-types/initConfigs.d.ts +2 -3
- package/dist-types/initPlugins.d.ts +1 -1
- package/dist-types/inspectConfig.d.ts +1 -1
- package/dist-types/loadConfig.d.ts +24 -32
- package/dist-types/loadEnv.d.ts +48 -57
- package/dist-types/loader/transformRawLoader.d.ts +1 -0
- package/dist-types/logger.d.ts +1 -2
- package/dist-types/mergeConfig.d.ts +1 -2
- package/dist-types/pluginHelper.d.ts +1 -2
- package/dist-types/pluginManager.d.ts +4 -7
- package/dist-types/plugins/basic.d.ts +1 -2
- package/dist-types/plugins/css.d.ts +5 -1
- package/dist-types/plugins/externals.d.ts +1 -1
- package/dist-types/plugins/fileSize.d.ts +6 -5
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +1 -0
- package/dist-types/plugins/swc.d.ts +1 -2
- package/dist-types/restart.d.ts +4 -5
- package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +2 -3
- package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +2 -3
- package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +3 -4
- package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +1 -2
- package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +2 -3
- package/dist-types/rspackConfig.d.ts +1 -1
- package/dist-types/server/ansiHTML.d.ts +1 -2
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +1 -2
- package/dist-types/server/assets-middleware/index.d.ts +3 -5
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +1 -2
- package/dist-types/server/browserLogs.d.ts +1 -2
- package/dist-types/server/buildManager.d.ts +4 -6
- package/dist-types/server/cliShortcuts.d.ts +3 -1
- package/dist-types/server/devMiddlewares.d.ts +2 -3
- package/dist-types/server/devServer.d.ts +18 -23
- package/dist-types/server/gracefulShutdown.d.ts +2 -4
- package/dist-types/server/gzipMiddleware.d.ts +1 -1
- package/dist-types/server/helper.d.ts +39 -47
- package/dist-types/server/historyApiFallback.d.ts +8 -1
- package/dist-types/server/httpServer.d.ts +1 -1
- package/dist-types/server/middlewares.d.ts +4 -8
- package/dist-types/server/open.d.ts +1 -1
- package/dist-types/server/runner/basic.d.ts +4 -5
- package/dist-types/server/runner/index.d.ts +3 -1
- package/dist-types/server/socketServer.d.ts +24 -18
- package/dist-types/server/watchFiles.d.ts +1 -1
- package/dist-types/types/config.d.ts +1197 -1457
- package/dist-types/types/context.d.ts +63 -92
- package/dist-types/types/hooks.d.ts +106 -150
- package/dist-types/types/plugin.d.ts +359 -444
- package/dist-types/types/rsbuild.d.ts +156 -191
- package/dist-types/types/thirdParty.d.ts +101 -132
- package/dist-types/types/utils.d.ts +2 -5
- package/package.json +10 -10
- package/dist-types/client/hmr.d.ts +0 -3
- package/dist-types/client/log.d.ts +0 -13
- package/dist-types/client/overlay.d.ts +0 -1
- /package/dist/{753.js.LICENSE.txt → 756.js.LICENSE.txt} +0 -0
- /package/dist/client/{797.js → 60.js} +0 -0
|
@@ -16,18 +16,17 @@ import type { RsbuildPlugins } from './plugin';
|
|
|
16
16
|
import type { RsbuildEntry, RsbuildMode, RsbuildTarget } from './rsbuild';
|
|
17
17
|
import type { Rspack, RspackRule } from './rspack';
|
|
18
18
|
import type { Connect, CSSExtractOptions, CSSLoaderModulesOptions, CSSLoaderOptions, HtmlRspackPlugin, LoosePostCSSPlugin, PostCSSLoaderOptions, StyleLoaderOptions } from './thirdParty';
|
|
19
|
-
import type { ConfigChain,
|
|
19
|
+
import type { ConfigChain, ConfigChainAsyncWithContext, ConfigChainWithContext, LiteralUnion, MaybePromise, OneOrMany, Optional, TwoLevelReadonly } from './utils';
|
|
20
20
|
export type ToolsSwcConfig = ConfigChain<SwcLoaderOptions>;
|
|
21
21
|
export type ToolsBundlerChainConfig = OneOrMany<(chain: RspackChain, utils: ModifyBundlerChainUtils) => MaybePromise<void>>;
|
|
22
22
|
export type ToolsPostCSSContext = {
|
|
23
23
|
addPlugins: (plugins: LoosePostCSSPlugin | LoosePostCSSPlugin[], options?: {
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
order?: 'pre' | 'post';
|
|
25
|
+
* Controls where the plugin is placed relative to the existing PostCSS plugins.
|
|
26
|
+
* - `pre`: Insert the plugin before all existing plugins.
|
|
27
|
+
* - `post`: Insert the plugin after all existing plugins.
|
|
28
|
+
* @default `post`
|
|
29
|
+
*/ order?: 'pre' | 'post';
|
|
31
30
|
}) => void;
|
|
32
31
|
};
|
|
33
32
|
export type ToolsPostCSSLoaderConfig = ConfigChainWithContext<PostCSSLoaderOptions, ToolsPostCSSContext>;
|
|
@@ -37,12 +36,13 @@ export type ToolsHtmlPluginConfig = ConfigChainWithContext<HtmlRspackPlugin.Opti
|
|
|
37
36
|
entryName: string;
|
|
38
37
|
entryValue: (string | string[] | Rspack.EntryDescription)[];
|
|
39
38
|
}>;
|
|
39
|
+
// equivalent to import('rspack-merge').merge
|
|
40
40
|
export type RspackMerge = (firstConfiguration: Rspack.Configuration | Rspack.Configuration[], ...configurations: Rspack.Configuration[]) => Rspack.Configuration;
|
|
41
41
|
export type ModifyRspackConfigUtils = ModifyChainUtils & {
|
|
42
|
-
addRules: (rules: RspackRule
|
|
43
|
-
appendRules: (rules: RspackRule
|
|
44
|
-
prependPlugins: (plugins: Rspack.
|
|
45
|
-
appendPlugins: (plugins: Rspack.
|
|
42
|
+
addRules: (rules: OneOrMany<RspackRule>) => void;
|
|
43
|
+
appendRules: (rules: OneOrMany<RspackRule>) => void;
|
|
44
|
+
prependPlugins: (plugins: OneOrMany<Rspack.Plugin>) => void;
|
|
45
|
+
appendPlugins: (plugins: OneOrMany<Rspack.Plugin>) => void;
|
|
46
46
|
removePlugin: (pluginName: string) => void;
|
|
47
47
|
mergeConfig: RspackMerge;
|
|
48
48
|
};
|
|
@@ -73,63 +73,49 @@ export type ModifyRspackConfigUtils = ModifyChainUtils & {
|
|
|
73
73
|
* }
|
|
74
74
|
* }
|
|
75
75
|
* ```
|
|
76
|
-
*/
|
|
77
|
-
export type NarrowedRspackConfig = Omit<Rspack.Configuration, 'plugins' | 'module' | 'resolve' | 'output'> & {
|
|
76
|
+
*/ export type NarrowedRspackConfig = Omit<Rspack.Configuration, 'plugins' | 'module' | 'resolve' | 'output'> & {
|
|
78
77
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
plugins: NonNullable<Rspack.Configuration['plugins']>;
|
|
78
|
+
* Plugins to use during compilation.
|
|
79
|
+
*/ plugins: Rspack.Plugin[];
|
|
82
80
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
module: NonNullable<Rspack.Configuration['module']>;
|
|
81
|
+
* Options for module configuration.
|
|
82
|
+
*/ module: NonNullable<Rspack.Configuration['module']>;
|
|
86
83
|
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
resolve: NonNullable<Rspack.Configuration['resolve']>;
|
|
84
|
+
* Options for resolving modules.
|
|
85
|
+
*/ resolve: NonNullable<Rspack.Configuration['resolve']>;
|
|
90
86
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
output: NonNullable<Rspack.Configuration['output']>;
|
|
87
|
+
* Configuration for the output of the compilation.
|
|
88
|
+
*/ output: NonNullable<Rspack.Configuration['output']>;
|
|
94
89
|
};
|
|
95
90
|
export type ToolsRspackConfig = OneOrMany<Rspack.Configuration | ((config: NarrowedRspackConfig, ctx: ModifyRspackConfigUtils) => MaybePromise<Rspack.Configuration | void>)>;
|
|
96
91
|
export interface ToolsConfig {
|
|
97
92
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
bundlerChain?: ToolsBundlerChainConfig;
|
|
93
|
+
* Configure bundler config base on [rspack-chain](https://github.com/rstackjs/rspack-chain)
|
|
94
|
+
*/ bundlerChain?: ToolsBundlerChainConfig;
|
|
101
95
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
cssLoader?: ToolsCSSLoaderConfig;
|
|
96
|
+
* Modify the options of [css-loader](https://github.com/webpack/css-loader).
|
|
97
|
+
*/ cssLoader?: ToolsCSSLoaderConfig;
|
|
105
98
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
postcss?: ToolsPostCSSLoaderConfig;
|
|
99
|
+
* Modify the options of [postcss-loader](https://github.com/webpack/postcss-loader).
|
|
100
|
+
*/ postcss?: ToolsPostCSSLoaderConfig;
|
|
109
101
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
styleLoader?: ToolsStyleLoaderConfig;
|
|
102
|
+
* Modify the options of [style-loader](https://github.com/webpack/style-loader).
|
|
103
|
+
*/ styleLoader?: ToolsStyleLoaderConfig;
|
|
113
104
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
htmlPlugin?: boolean | ToolsHtmlPluginConfig;
|
|
105
|
+
* Configure the html-rspack-plugin.
|
|
106
|
+
*/ htmlPlugin?: boolean | ToolsHtmlPluginConfig;
|
|
117
107
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
swc?: ToolsSwcConfig;
|
|
108
|
+
* Configure the `builtin:swc-loader` of Rspack.
|
|
109
|
+
*/ swc?: ToolsSwcConfig;
|
|
121
110
|
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
lightningcssLoader?: boolean | ConfigChain<Rspack.LightningcssLoaderOptions>;
|
|
111
|
+
* Configure the `builtin:lightningcss-loader` of Rspack.
|
|
112
|
+
*/ lightningcssLoader?: boolean | ConfigChain<Rspack.LightningcssLoaderOptions>;
|
|
125
113
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
cssExtract?: CSSExtractOptions;
|
|
114
|
+
* Modify the options of [CssExtractRspackPlugin](https://rspack.rs/plugins/rspack/css-extract-rspack-plugin).
|
|
115
|
+
*/ cssExtract?: CSSExtractOptions;
|
|
129
116
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
rspack?: ToolsRspackConfig;
|
|
117
|
+
* Configure Rspack.
|
|
118
|
+
*/ rspack?: ToolsRspackConfig;
|
|
133
119
|
}
|
|
134
120
|
export type NormalizedToolsConfig = ToolsConfig & {
|
|
135
121
|
cssExtract: Required<CSSExtractOptions>;
|
|
@@ -138,76 +124,68 @@ export type Alias = Record<string, string | false | (string | false)[]>;
|
|
|
138
124
|
export type AliasStrategy = 'prefer-tsconfig' | 'prefer-alias';
|
|
139
125
|
export type Decorators = {
|
|
140
126
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
* Specify the version of decorators to use.
|
|
128
|
+
* @default '2023-11'
|
|
129
|
+
*/ version?: 'legacy'// stage 1
|
|
130
|
+
| '2022-03'// stage 3
|
|
131
|
+
| '2023-11';
|
|
145
132
|
};
|
|
146
133
|
export interface SourceConfig {
|
|
147
134
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Used to import the code and style of the component library on demand.
|
|
204
|
-
*/
|
|
205
|
-
transformImport?: TransformImportFn | (TransformImport | TransformImportFn)[];
|
|
206
|
-
/**
|
|
207
|
-
* Configure a custom tsconfig.json file path to use, can be a relative or absolute path.
|
|
208
|
-
* @default 'tsconfig.json'
|
|
209
|
-
*/
|
|
210
|
-
tsconfigPath?: string;
|
|
135
|
+
* Include additional files that should be treated as static assets.
|
|
136
|
+
* @default undefined
|
|
137
|
+
*/ assetsInclude?: Rspack.RuleSetCondition;
|
|
138
|
+
/**
|
|
139
|
+
* Specify additional JavaScript files that need to be compiled by SWC.
|
|
140
|
+
* Through the `source.include` config, you can specify directories or modules
|
|
141
|
+
* that need to be compiled by Rsbuild. The usage of `source.include` is
|
|
142
|
+
* consistent with [rules[].include](https://rspack.rs/config/module-rules#rulesinclude)
|
|
143
|
+
* in Rspack, which supports passing in strings or regular expressions to match
|
|
144
|
+
* the module path.
|
|
145
|
+
* @default
|
|
146
|
+
* [
|
|
147
|
+
* { and: [rootPath, { not: /[\\/]node_modules[\\/]/ }], },
|
|
148
|
+
* /\.(?:ts|tsx|jsx|mts|cts)$/,
|
|
149
|
+
* ];
|
|
150
|
+
*/ include?: RuleSetCondition[];
|
|
151
|
+
/**
|
|
152
|
+
* Set the entry modules for building.
|
|
153
|
+
*
|
|
154
|
+
* The value of `source.entry` is an object, the key is the entry name, and the
|
|
155
|
+
* value is the path of the entry module or a description object.
|
|
156
|
+
*
|
|
157
|
+
* If the value is a path, it can be an absolute path or a relative path, the
|
|
158
|
+
* relative path will be resolved based on `root`.
|
|
159
|
+
*
|
|
160
|
+
* @default
|
|
161
|
+
* {
|
|
162
|
+
* // Rsbuild also supports other suffixes by default, such as ts,
|
|
163
|
+
* // tsx, jsx, mts, cts, mjs, cjs
|
|
164
|
+
* index: './src/index.js',
|
|
165
|
+
* }
|
|
166
|
+
*/ entry?: RsbuildEntry;
|
|
167
|
+
/**
|
|
168
|
+
* Exclude JavaScript or TypeScript files that do not need to be compiled by SWC.
|
|
169
|
+
*/ exclude?: RuleSetCondition[];
|
|
170
|
+
/**
|
|
171
|
+
* Add a script before the entry file of each page.
|
|
172
|
+
* This script will be executed before the page code.
|
|
173
|
+
* It can be used to execute global logics, such as polyfill injection.
|
|
174
|
+
*/ preEntry?: string | string[];
|
|
175
|
+
/**
|
|
176
|
+
* Replaces variables in your code with other values or expressions at compile time.
|
|
177
|
+
* This is useful for enabling different behavior between development and production builds.
|
|
178
|
+
*/ define?: DefinePluginOptions;
|
|
179
|
+
/**
|
|
180
|
+
* Configuring decorators syntax.
|
|
181
|
+
*/ decorators?: Decorators;
|
|
182
|
+
/**
|
|
183
|
+
* Used to import the code and style of the component library on demand.
|
|
184
|
+
*/ transformImport?: TransformImportFn | (TransformImport | TransformImportFn)[];
|
|
185
|
+
/**
|
|
186
|
+
* Configure a custom tsconfig.json file path to use, can be a relative or absolute path.
|
|
187
|
+
* @default 'tsconfig.json'
|
|
188
|
+
*/ tsconfigPath?: string;
|
|
211
189
|
}
|
|
212
190
|
export type TransformImport = {
|
|
213
191
|
libraryName: string;
|
|
@@ -232,15 +210,14 @@ export type ProxyBypass = (req: IncomingMessage, res: ServerResponse, proxyOptio
|
|
|
232
210
|
export type { ProxyFilter };
|
|
233
211
|
export type ProxyOptions = HttpProxyOptions & {
|
|
234
212
|
/**
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
bypass?: ProxyBypass;
|
|
213
|
+
* Use the `bypass` function to skip the proxy.
|
|
214
|
+
* Inside the function, you have access to the request, response, and proxy options.
|
|
215
|
+
* - Return `null` or `undefined` to continue processing the request with proxy.
|
|
216
|
+
* - Return `true` to skip the proxy and continue processing the request.
|
|
217
|
+
* - Return `false` to produce a 404 error for the request.
|
|
218
|
+
* - Return a specific path to replace the original request path.
|
|
219
|
+
* - Return a Promise to handle the request asynchronously.
|
|
220
|
+
*/ bypass?: ProxyBypass;
|
|
244
221
|
};
|
|
245
222
|
export type ProxyConfig = Record<string, string | ProxyOptions> | ProxyOptions[];
|
|
246
223
|
export type HistoryApiFallbackContext = {
|
|
@@ -251,33 +228,29 @@ export type HistoryApiFallbackContext = {
|
|
|
251
228
|
export type HistoryApiFallbackTo = string | ((context: HistoryApiFallbackContext) => string);
|
|
252
229
|
export type HistoryApiFallbackOptions = {
|
|
253
230
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
* the request, meaning it has entered the fallback stage. Each rule is evaluated in
|
|
278
|
-
* order until a match is found and executed.
|
|
279
|
-
*/
|
|
280
|
-
rewrites?: {
|
|
231
|
+
* Specifies the default HTML file to return when the History API fallback is enabled.
|
|
232
|
+
* For example, if you set `historyApiFallback.index` to `main.html`, the server will
|
|
233
|
+
* automatically serve `main.html` as the fallback page when users access any unmatched
|
|
234
|
+
* routes.
|
|
235
|
+
* @default 'index.html'
|
|
236
|
+
*/ index?: string;
|
|
237
|
+
/**
|
|
238
|
+
* Override the default `Accepts:` headers that are queried when matching HTML content
|
|
239
|
+
* requests.
|
|
240
|
+
* @default ['text/html', '*\/*']
|
|
241
|
+
*/ htmlAcceptHeaders?: string[];
|
|
242
|
+
/**
|
|
243
|
+
* By default, requests containing a dot (`.`) in the path are treated as direct file
|
|
244
|
+
* requests and are not redirected. Setting `disableDotRule` to `true` will disable this
|
|
245
|
+
* behavior and allow such requests to be redirected as well.
|
|
246
|
+
* @default false
|
|
247
|
+
*/ disableDotRule?: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* `rewrites` lets you customize how request paths are mapped to HTML files when
|
|
250
|
+
* a History API fallback occurs. These rules only apply when no static asset matches
|
|
251
|
+
* the request, meaning it has entered the fallback stage. Each rule is evaluated in
|
|
252
|
+
* order until a match is found and executed.
|
|
253
|
+
*/ rewrites?: {
|
|
281
254
|
from: RegExp;
|
|
282
255
|
to: HistoryApiFallbackTo;
|
|
283
256
|
}[];
|
|
@@ -293,164 +266,141 @@ export type PrintUrls = boolean | ((params: {
|
|
|
293
266
|
})[] | void);
|
|
294
267
|
export type PublicDirOptions = {
|
|
295
268
|
/**
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
* during production builds.
|
|
316
|
-
* @default []
|
|
317
|
-
*/
|
|
318
|
-
ignore?: string[];
|
|
269
|
+
* The name of the public directory, can be set as a relative path or an absolute path.
|
|
270
|
+
* @default 'public'
|
|
271
|
+
*/ name?: string;
|
|
272
|
+
/**
|
|
273
|
+
* Whether to copy files from the public directory to the dist directory on production build.
|
|
274
|
+
* - `true`: copy files
|
|
275
|
+
* - `false`: do not copy files
|
|
276
|
+
* - `'auto'`: if `output.target` is not `'node'`, copy files, otherwise do not copy
|
|
277
|
+
* @default 'auto'
|
|
278
|
+
*/ copyOnBuild?: boolean | 'auto';
|
|
279
|
+
/**
|
|
280
|
+
* whether to watch the public directory and reload the page when the files change
|
|
281
|
+
* @default false
|
|
282
|
+
*/ watch?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Glob patterns for files or directories to ignore when copying the public directory
|
|
285
|
+
* during production builds.
|
|
286
|
+
* @default []
|
|
287
|
+
*/ ignore?: string[];
|
|
319
288
|
};
|
|
320
289
|
export type PublicDir = false | PublicDirOptions | PublicDirOptions[];
|
|
321
290
|
/**
|
|
322
291
|
* The options for `server.compress`.
|
|
323
|
-
*/
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
* - 6 for preview server (also known as `zlib.constants.Z_DEFAULT_COMPRESSION`)
|
|
340
|
-
*/
|
|
341
|
-
level?: number;
|
|
292
|
+
*/ export type CompressOptions = {
|
|
293
|
+
/**
|
|
294
|
+
* A function that determines whether a response should be compressed.
|
|
295
|
+
* @param req - The incoming HTTP request
|
|
296
|
+
* @param res - The outgoing HTTP response
|
|
297
|
+
* @returns `true` to compress the response, `false` to skip compression
|
|
298
|
+
*/ filter?: (req: IncomingMessage, res: ServerResponse) => boolean;
|
|
299
|
+
/**
|
|
300
|
+
* The level of zlib compression to apply to responses.
|
|
301
|
+
* A higher level will result in better compression, but will take longer to complete.
|
|
302
|
+
* A lower level will result in less compression, but will be much faster.
|
|
303
|
+
* This is an integer in the range of 0 (no compression) to 9 (maximum compression).
|
|
304
|
+
* @default
|
|
305
|
+
* - 1 (fastest) for dev server (also known as `zlib.constants.Z_BEST_SPEED`)
|
|
306
|
+
* - 6 for preview server (also known as `zlib.constants.Z_DEFAULT_COMPRESSION`)
|
|
307
|
+
*/ level?: number;
|
|
342
308
|
};
|
|
343
309
|
export interface ServerConfig {
|
|
344
310
|
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
* When a user visits a path that does not exist, it will automatically
|
|
391
|
-
* return a specified HTML file to avoid a 404 error.
|
|
392
|
-
* @default false
|
|
393
|
-
*/
|
|
394
|
-
historyApiFallback?: boolean | HistoryApiFallbackOptions;
|
|
395
|
-
/**
|
|
396
|
-
* Set the page URL to open when the server starts.
|
|
397
|
-
* @default false
|
|
398
|
-
*/
|
|
399
|
-
open?: boolean | string | string[] | {
|
|
311
|
+
* Configure the base path of the server.
|
|
312
|
+
* @default '/'
|
|
313
|
+
*/ base?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Whether to enable gzip compression for served static assets.
|
|
316
|
+
* Pass an object to customize the compression behavior.
|
|
317
|
+
* @default true
|
|
318
|
+
*/ compress?: boolean | CompressOptions;
|
|
319
|
+
/**
|
|
320
|
+
* Serving static files from the directory
|
|
321
|
+
* @default { name: 'public', copyOnBuild: 'auto', watch: false }
|
|
322
|
+
*/ publicDir?: PublicDir;
|
|
323
|
+
/**
|
|
324
|
+
* Specify a port number for Rsbuild server to listen.
|
|
325
|
+
* @default 3000
|
|
326
|
+
*/ port?: number;
|
|
327
|
+
/**
|
|
328
|
+
* Configure HTTPS options to enable HTTPS server.
|
|
329
|
+
* When enabled, HTTP server will be disabled.
|
|
330
|
+
* @default undefined
|
|
331
|
+
*/ https?: HttpsServerOptions | SecureServerSessionOptions;
|
|
332
|
+
/**
|
|
333
|
+
* Specify the host that the Rsbuild server listens to.
|
|
334
|
+
* - `string`: specify a hostname or IP address to listen on.
|
|
335
|
+
* - `true`: equals to `0.0.0.0`, listen on all interfaces.
|
|
336
|
+
* - `false`: equals to `localhost`
|
|
337
|
+
* @default 'localhost'
|
|
338
|
+
*/ host?: string | boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Adds headers to all responses.
|
|
341
|
+
*/ headers?: Record<string, string | string[]>;
|
|
342
|
+
/**
|
|
343
|
+
* Whether to enable HTML fallback.
|
|
344
|
+
* @default 'index'
|
|
345
|
+
*/ htmlFallback?: HtmlFallback;
|
|
346
|
+
/**
|
|
347
|
+
* Used to support routing based on the history API.
|
|
348
|
+
* When a user visits a path that does not exist, it will automatically
|
|
349
|
+
* return a specified HTML file to avoid a 404 error.
|
|
350
|
+
* @default false
|
|
351
|
+
*/ historyApiFallback?: boolean | HistoryApiFallbackOptions;
|
|
352
|
+
/**
|
|
353
|
+
* Set the page URL to open when the server starts.
|
|
354
|
+
* @default false
|
|
355
|
+
*/ open?: boolean | string | string[] | {
|
|
400
356
|
target?: string | string[];
|
|
401
357
|
before?: () => Promise<void> | void;
|
|
402
358
|
};
|
|
403
359
|
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
* `server.setup` can return a callback function. After built-in middlewares are registered,
|
|
449
|
-
* Rsbuild will execute that callback. Middlewares registered in the callback run later than built-ins.
|
|
450
|
-
*
|
|
451
|
-
* @default undefined
|
|
452
|
-
*/
|
|
453
|
-
setup?: ServerSetupFn | ServerSetupFn[];
|
|
360
|
+
* Configure CORS for the dev server or preview server.
|
|
361
|
+
* - object: enable CORS with the specified options.
|
|
362
|
+
* - true: enable CORS with default options (allow all origins, not recommended).
|
|
363
|
+
* - false: disable CORS.
|
|
364
|
+
* @default
|
|
365
|
+
* ```js
|
|
366
|
+
* { origin: defaultAllowedOrigins }
|
|
367
|
+
* ```
|
|
368
|
+
* where `defaultAllowedOrigins` includes:
|
|
369
|
+
* - `localhost`
|
|
370
|
+
* - `127.0.0.1`
|
|
371
|
+
* - `[::1]`
|
|
372
|
+
*
|
|
373
|
+
* @link https://github.com/expressjs/cors
|
|
374
|
+
*/ cors?: boolean | Cors.CorsOptions;
|
|
375
|
+
/**
|
|
376
|
+
* Configure proxy rules for the dev server or preview server to proxy requests to
|
|
377
|
+
* the specified service.
|
|
378
|
+
*/ proxy?: ProxyConfig;
|
|
379
|
+
/**
|
|
380
|
+
* Whether to throw an error when the port is occupied.
|
|
381
|
+
* @default false
|
|
382
|
+
*/ strictPort?: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Controls whether and how server URLs are printed when the server starts.
|
|
385
|
+
* @default true
|
|
386
|
+
*/ printUrls?: PrintUrls;
|
|
387
|
+
/**
|
|
388
|
+
* Whether to create Rsbuild's server in middleware mode, which is useful for
|
|
389
|
+
* integrating with other servers.
|
|
390
|
+
* @default false
|
|
391
|
+
*/ middlewareMode?: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* Run setup logic when the Rsbuild dev server or preview server starts,
|
|
394
|
+
* such as registering custom middleware or running pre-start tasks.
|
|
395
|
+
*
|
|
396
|
+
* When `server.setup` is called, Rsbuild built-in middlewares are not registered yet,
|
|
397
|
+
* so middlewares you add run earlier than built-ins.
|
|
398
|
+
*
|
|
399
|
+
* `server.setup` can return a callback function. After built-in middlewares are registered,
|
|
400
|
+
* Rsbuild will execute that callback. Middlewares registered in the callback run later than built-ins.
|
|
401
|
+
*
|
|
402
|
+
* @default undefined
|
|
403
|
+
*/ setup?: ServerSetupFn | ServerSetupFn[];
|
|
454
404
|
}
|
|
455
405
|
export type NormalizedServerConfig = {
|
|
456
406
|
host: string;
|
|
@@ -458,98 +408,82 @@ export type NormalizedServerConfig = {
|
|
|
458
408
|
} & Omit<Optional<Required<ServerConfig>, 'headers' | 'https' | 'historyApiFallback' | 'proxy' | 'setup'>, 'host' | 'publicDir'>;
|
|
459
409
|
export type ServerSetupContext = {
|
|
460
410
|
/**
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
environments: Record<string, EnvironmentContext>;
|
|
411
|
+
* Environment contexts of all environments.
|
|
412
|
+
*/ environments: Record<string, EnvironmentContext>;
|
|
464
413
|
} & ({
|
|
465
414
|
/**
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
action: 'dev';
|
|
415
|
+
* Action type of current server.
|
|
416
|
+
*/ action: 'dev';
|
|
469
417
|
/**
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
server: RsbuildDevServer;
|
|
418
|
+
* Dev server instance, only available in dev mode.
|
|
419
|
+
*/ server: RsbuildDevServer;
|
|
473
420
|
} | {
|
|
474
421
|
/**
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
action: 'preview';
|
|
422
|
+
* Action type of current server.
|
|
423
|
+
*/ action: 'preview';
|
|
478
424
|
/**
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
server: RsbuildPreviewServer;
|
|
425
|
+
* Preview server instance, only available in preview mode.
|
|
426
|
+
*/ server: RsbuildPreviewServer;
|
|
482
427
|
});
|
|
483
428
|
/**
|
|
484
429
|
* Server setup function.
|
|
485
430
|
* Return a callback to run after built-in middlewares are registered.
|
|
486
|
-
*/
|
|
487
|
-
export type ServerSetupFn = (context: ServerSetupContext) => MaybePromise<(() => MaybePromise<void>) | void>;
|
|
431
|
+
*/ export type ServerSetupFn = (context: ServerSetupContext) => MaybePromise<(() => MaybePromise<void>) | void>;
|
|
488
432
|
export type SriAlgorithm = 'sha256' | 'sha384' | 'sha512';
|
|
489
433
|
export type SriOptions = {
|
|
490
434
|
/**
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
algorithm?: SriAlgorithm | SriAlgorithm[];
|
|
435
|
+
* Specifies the algorithm used to compute the integrity hash.
|
|
436
|
+
* @default 'sha384'
|
|
437
|
+
*/ algorithm?: SriAlgorithm | SriAlgorithm[];
|
|
495
438
|
/**
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
enable?: boolean | 'auto';
|
|
439
|
+
* Whether to enable SRI.
|
|
440
|
+
* `'auto'` means it's enabled in production mode and disabled in development mode.
|
|
441
|
+
* @default false
|
|
442
|
+
*/ enable?: boolean | 'auto';
|
|
501
443
|
};
|
|
502
444
|
export interface SecurityConfig {
|
|
503
445
|
/**
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
*/
|
|
514
|
-
sri?: SriOptions;
|
|
446
|
+
* Adding a `nonce` attribute to the scripts resources introduced for HTML. This allows
|
|
447
|
+
* the browser to determine whether the script can be executed when it parses inline
|
|
448
|
+
* scripts with matching nonce values.
|
|
449
|
+
*/ nonce?: string;
|
|
450
|
+
/**
|
|
451
|
+
* Adding an integrity attribute (`integrity`) to sub-resources introduced by HTML
|
|
452
|
+
* allows the browser to verify the integrity of the introduced resource, thus preventing
|
|
453
|
+
* tampering with the downloaded resource.
|
|
454
|
+
*/ sri?: SriOptions;
|
|
515
455
|
}
|
|
516
456
|
export type NormalizedSecurityConfig = Required<SecurityConfig>;
|
|
517
457
|
export type ConsoleType = 'log' | 'info' | 'warn' | 'error' | 'table' | 'group';
|
|
518
458
|
export type BuildCacheOptions = {
|
|
519
459
|
/**
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
* Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
533
|
-
*/
|
|
534
|
-
buildDependencies?: string[];
|
|
460
|
+
* The output directory of the cache files.
|
|
461
|
+
* @default 'node_modules/.cache'
|
|
462
|
+
*/ cacheDirectory?: string;
|
|
463
|
+
/**
|
|
464
|
+
* Add additional cache digests, the previous build cache will be invalidated
|
|
465
|
+
* when any value in the array changes.
|
|
466
|
+
* @default undefined
|
|
467
|
+
*/ cacheDigest?: (string | undefined)[];
|
|
468
|
+
/**
|
|
469
|
+
* An array of files containing build dependencies.
|
|
470
|
+
* Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
471
|
+
*/ buildDependencies?: string[];
|
|
535
472
|
};
|
|
536
473
|
export type PrintFileSizeAsset = {
|
|
537
474
|
/**
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
name: string;
|
|
475
|
+
* The name of the asset.
|
|
476
|
+
* @example 'index.html', 'static/js/index.[hash].js'
|
|
477
|
+
*/ name: string;
|
|
542
478
|
/**
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
size: number;
|
|
479
|
+
* The size of the asset in bytes.
|
|
480
|
+
*/ size: number;
|
|
546
481
|
};
|
|
547
482
|
export type PrintFileSizeOptions = {
|
|
548
483
|
/**
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
total?: boolean | ((params: {
|
|
484
|
+
* Whether to print the total size of all static assets, or a function to generate custom total output.
|
|
485
|
+
* @default true
|
|
486
|
+
*/ total?: boolean | ((params: {
|
|
553
487
|
environmentName: string;
|
|
554
488
|
distPath: string;
|
|
555
489
|
assets: PrintFileSizeAsset[];
|
|
@@ -557,47 +491,40 @@ export type PrintFileSizeOptions = {
|
|
|
557
491
|
totalGzipSize: number;
|
|
558
492
|
}) => string);
|
|
559
493
|
/**
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
* each build. On subsequent builds, Rsbuild compares the current sizes against the previous
|
|
587
|
-
* snapshot and shows the change inline in parentheses.
|
|
588
|
-
* @default false
|
|
589
|
-
*/
|
|
590
|
-
diff?: boolean;
|
|
494
|
+
* Whether to print the size of each static asset.
|
|
495
|
+
* @default true
|
|
496
|
+
*/ detail?: boolean;
|
|
497
|
+
/**
|
|
498
|
+
* Whether to print the gzip-compressed size of each static asset.
|
|
499
|
+
* Disable this option can save some gzip computation time for large projects.
|
|
500
|
+
* @default true
|
|
501
|
+
*/ compressed?: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* A filter function to determine which static assets to print.
|
|
504
|
+
* If returned `false`, the static asset will be excluded and not included in the
|
|
505
|
+
* total size or detailed size.
|
|
506
|
+
* @default undefined
|
|
507
|
+
*/ include?: (asset: PrintFileSizeAsset) => boolean;
|
|
508
|
+
/**
|
|
509
|
+
* A filter function to exclude static assets from the total size or detailed size.
|
|
510
|
+
* If both `include` and `exclude` are set, `exclude` will take precedence.
|
|
511
|
+
* @default (asset) => /\.(?:map|LICENSE\.txt)$/.test(asset.name)
|
|
512
|
+
*/ exclude?: (asset: PrintFileSizeAsset) => boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Controls whether file size differences are displayed relative to the previous build.
|
|
515
|
+
* When this option is enabled, Rsbuild records a snapshot of all output file sizes after
|
|
516
|
+
* each build. On subsequent builds, Rsbuild compares the current sizes against the previous
|
|
517
|
+
* snapshot and shows the change inline in parentheses.
|
|
518
|
+
* @default false
|
|
519
|
+
*/ diff?: boolean;
|
|
591
520
|
};
|
|
592
521
|
export interface PreconnectOption {
|
|
593
522
|
/**
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
href: string;
|
|
523
|
+
* The URL of the resource to preconnect to.
|
|
524
|
+
*/ href: string;
|
|
597
525
|
/**
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
crossorigin?: boolean;
|
|
526
|
+
* Whether to add `crossorigin` attribute to the `<link>` element.
|
|
527
|
+
*/ crossorigin?: boolean;
|
|
601
528
|
}
|
|
602
529
|
export type Preconnect = (string | PreconnectOption)[];
|
|
603
530
|
export type DnsPrefetch = string[];
|
|
@@ -606,102 +533,90 @@ export type ResourceHintsFilterFn = (filename: string) => boolean;
|
|
|
606
533
|
export type ResourceHintsFilter = OneOrMany<string | RegExp | ResourceHintsFilterFn>;
|
|
607
534
|
export interface ResourceHintsOptions {
|
|
608
535
|
/**
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
* not be preloaded additionally.
|
|
630
|
-
* @default true
|
|
631
|
-
*/
|
|
632
|
-
dedupe?: boolean;
|
|
536
|
+
* Specifies which types of resources will be included.
|
|
537
|
+
* - `async-chunks`: Includes all async resources on the current page, such as async JS
|
|
538
|
+
* chunks, and its associated CSS, images, fonts, and other static resources.
|
|
539
|
+
* - `initial`: Includes all non-async resources on the current page.
|
|
540
|
+
* - `all-chunks`: Includes all async and non-async resources on the current page.
|
|
541
|
+
* - `all-assets`: Includes all resources from all pages.
|
|
542
|
+
* @default 'async-chunks'
|
|
543
|
+
*/ type?: ResourceHintsIncludeType;
|
|
544
|
+
/**
|
|
545
|
+
* A extra filter to determine which resources to include.
|
|
546
|
+
*/ include?: ResourceHintsFilter;
|
|
547
|
+
/**
|
|
548
|
+
* A extra filter to determine which resources to exclude.
|
|
549
|
+
*/ exclude?: ResourceHintsFilter;
|
|
550
|
+
/**
|
|
551
|
+
* Whether to dedupe script resources that already exist in the current HTML content.
|
|
552
|
+
* By default, if a resource has been added to the current HTML via a script tag, it will
|
|
553
|
+
* not be preloaded additionally.
|
|
554
|
+
* @default true
|
|
555
|
+
*/ dedupe?: boolean;
|
|
633
556
|
}
|
|
634
557
|
export type PreloadOptions = ResourceHintsOptions;
|
|
635
558
|
export type PrefetchOptions = Omit<ResourceHintsOptions, 'dedupe'>;
|
|
636
559
|
export interface PerformanceConfig {
|
|
637
560
|
/**
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
* ```js
|
|
698
|
-
* const defaultOptions = {
|
|
699
|
-
* type: 'async-chunks',
|
|
700
|
-
* };
|
|
701
|
-
* ```
|
|
702
|
-
* @default undefined
|
|
703
|
-
*/
|
|
704
|
-
prefetch?: true | PrefetchOptions;
|
|
561
|
+
* Whether to remove `console.[methodName]` in production build.
|
|
562
|
+
* @default false
|
|
563
|
+
*/ removeConsole?: boolean | ConsoleType[];
|
|
564
|
+
/**
|
|
565
|
+
* To enable or configure persistent build cache.
|
|
566
|
+
* @experimental This feature is experimental and may be changed in the future.
|
|
567
|
+
* @default false
|
|
568
|
+
*/ buildCache?: BuildCacheOptions | boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Whether to print the file sizes after production build.
|
|
571
|
+
* @default true
|
|
572
|
+
*/ printFileSize?: PrintFileSizeOptions | boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Configure the chunk splitting strategy.
|
|
575
|
+
* @deprecated Use `splitChunks` instead.
|
|
576
|
+
*/ chunkSplit?: ChunkSplit;
|
|
577
|
+
/**
|
|
578
|
+
* Used to control resource `Preconnect`.
|
|
579
|
+
*
|
|
580
|
+
* Specifies that the user agent should preemptively connect to the target resource's origin.
|
|
581
|
+
*/ preconnect?: Preconnect;
|
|
582
|
+
/**
|
|
583
|
+
* Used to control resource `DnsPrefetch`.
|
|
584
|
+
*
|
|
585
|
+
* Specifies that the user agent should preemptively perform DNS resolution for the target
|
|
586
|
+
* resource's origin.
|
|
587
|
+
*/ dnsPrefetch?: DnsPrefetch;
|
|
588
|
+
/**
|
|
589
|
+
* Inject the `<link rel="preload">` tags for the static assets generated by Rsbuild.
|
|
590
|
+
*
|
|
591
|
+
* `performance.preload` can be set to an object to specify the options.
|
|
592
|
+
*
|
|
593
|
+
* When `performance.preload` is set to `true`, Rsbuild will use the following default
|
|
594
|
+
* options to preload resources. This means preloading all async resources on the current
|
|
595
|
+
* page, including async JS and its associated CSS, image, font, and other resources.
|
|
596
|
+
*
|
|
597
|
+
* ```js
|
|
598
|
+
* const defaultOptions = {
|
|
599
|
+
* type: 'async-chunks',
|
|
600
|
+
* };
|
|
601
|
+
* ```
|
|
602
|
+
* @default undefined
|
|
603
|
+
*/ preload?: true | PreloadOptions;
|
|
604
|
+
/**
|
|
605
|
+
* Inject the `<link rel="prefetch">` tags for the static assets generated by Rsbuild.
|
|
606
|
+
*
|
|
607
|
+
* `performance.prefetch` can be set to an object to specify the options.
|
|
608
|
+
*
|
|
609
|
+
* When `performance.prefetch` is set to `true`, Rsbuild will use the following default
|
|
610
|
+
* options to prefetch resources. This means prefetching all async resources on the current
|
|
611
|
+
* page, including async JS and its associated CSS, image, font, and other resources.
|
|
612
|
+
*
|
|
613
|
+
* ```js
|
|
614
|
+
* const defaultOptions = {
|
|
615
|
+
* type: 'async-chunks',
|
|
616
|
+
* };
|
|
617
|
+
* ```
|
|
618
|
+
* @default undefined
|
|
619
|
+
*/ prefetch?: true | PrefetchOptions;
|
|
705
620
|
}
|
|
706
621
|
export interface NormalizedPerformanceConfig extends PerformanceConfig {
|
|
707
622
|
printFileSize: PrintFileSizeOptions | boolean;
|
|
@@ -714,8 +629,7 @@ export type SplitChunks = Rspack.OptimizationSplitChunksOptions | false;
|
|
|
714
629
|
* - `per-package`: splits dependencies in `node_modules` by npm package.
|
|
715
630
|
* - `single-vendor`: splits all `node_modules` dependencies into one vendor chunk.
|
|
716
631
|
* - `none`: disables Rsbuild preset rules.
|
|
717
|
-
*/
|
|
718
|
-
export type SplitChunksPreset = 'default' | 'single-vendor' | 'per-package' | 'none';
|
|
632
|
+
*/ export type SplitChunksPreset = 'default' | 'single-vendor' | 'per-package' | 'none';
|
|
719
633
|
export type SplitChunksConfig = Rspack.OptimizationSplitChunksOptions & {
|
|
720
634
|
preset?: SplitChunksPreset;
|
|
721
635
|
};
|
|
@@ -741,163 +655,134 @@ export interface SplitCustom extends BaseSplitRules {
|
|
|
741
655
|
export type ChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
|
|
742
656
|
export type DistPathConfig = {
|
|
743
657
|
/**
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
* @default 'static/media'
|
|
796
|
-
*/
|
|
797
|
-
media?: string;
|
|
798
|
-
/**
|
|
799
|
-
* The output directory of assets, except for above (image, svg, font, html, wasm...)
|
|
800
|
-
* @default 'static/assets'
|
|
801
|
-
*/
|
|
802
|
-
assets?: string;
|
|
803
|
-
/**
|
|
804
|
-
* The output directory of favicon.
|
|
805
|
-
* @default './'
|
|
806
|
-
*/
|
|
807
|
-
favicon?: string;
|
|
658
|
+
* The root directory of all files.
|
|
659
|
+
* @default 'dist'
|
|
660
|
+
**/ root?: string;
|
|
661
|
+
/**
|
|
662
|
+
* The output directory of JavaScript files.
|
|
663
|
+
* @default 'static/js'
|
|
664
|
+
*/ js?: string;
|
|
665
|
+
/**
|
|
666
|
+
* The output directory of async JavaScript files.
|
|
667
|
+
* @default 'static/js/async'
|
|
668
|
+
*/ jsAsync?: string;
|
|
669
|
+
/**
|
|
670
|
+
* The output directory of CSS files.
|
|
671
|
+
* @default 'static/css'
|
|
672
|
+
*/ css?: string;
|
|
673
|
+
/**
|
|
674
|
+
* The output directory of async CSS files.
|
|
675
|
+
* @default 'static/css/async'
|
|
676
|
+
*/ cssAsync?: string;
|
|
677
|
+
/**
|
|
678
|
+
* The output directory of SVG images.
|
|
679
|
+
* @default 'static/svg'
|
|
680
|
+
*/ svg?: string;
|
|
681
|
+
/**
|
|
682
|
+
* The output directory of font files.
|
|
683
|
+
* @default 'static/font'
|
|
684
|
+
*/ font?: string;
|
|
685
|
+
/**
|
|
686
|
+
* The output directory of HTML files.
|
|
687
|
+
* @default './'
|
|
688
|
+
*/ html?: string;
|
|
689
|
+
/**
|
|
690
|
+
* The output directory of Wasm files.
|
|
691
|
+
* @default 'static/wasm'
|
|
692
|
+
*/ wasm?: string;
|
|
693
|
+
/**
|
|
694
|
+
* The output directory of non-SVG images.
|
|
695
|
+
* @default 'static/image'
|
|
696
|
+
*/ image?: string;
|
|
697
|
+
/**
|
|
698
|
+
* The output directory of media resources, such as videos.
|
|
699
|
+
* @default 'static/media'
|
|
700
|
+
*/ media?: string;
|
|
701
|
+
/**
|
|
702
|
+
* The output directory of assets, except for above (image, svg, font, html, wasm...)
|
|
703
|
+
* @default 'static/assets'
|
|
704
|
+
*/ assets?: string;
|
|
705
|
+
/**
|
|
706
|
+
* The output directory of favicon.
|
|
707
|
+
* @default './'
|
|
708
|
+
*/ favicon?: string;
|
|
808
709
|
};
|
|
809
710
|
export type FilenameConfig = {
|
|
810
711
|
/**
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
* The name of Wasm files.
|
|
851
|
-
* @default '[hash].module.wasm'
|
|
852
|
-
*/
|
|
853
|
-
wasm?: Rspack.WebassemblyModuleFilename;
|
|
854
|
-
/**
|
|
855
|
-
* The name of other assets, except for above (image, svg, font, html, wasm...)
|
|
856
|
-
* @default '[name].[contenthash:10][ext]'
|
|
857
|
-
*/
|
|
858
|
-
assets?: Rspack.AssetModuleFilename;
|
|
712
|
+
* The name of HTML files.
|
|
713
|
+
* @default `[name].html`
|
|
714
|
+
*/ html?: string;
|
|
715
|
+
/**
|
|
716
|
+
* The name of the JavaScript files.
|
|
717
|
+
* @default
|
|
718
|
+
* - dev: '[name].js'
|
|
719
|
+
* - prod: '[name].[contenthash:10].js'
|
|
720
|
+
*/ js?: Rspack.Filename;
|
|
721
|
+
/**
|
|
722
|
+
* The name of the CSS files.
|
|
723
|
+
* @default
|
|
724
|
+
* - dev: '[name].css'
|
|
725
|
+
* - prod: '[name].[contenthash:10].css'
|
|
726
|
+
*/ css?: Rspack.CssFilename;
|
|
727
|
+
/**
|
|
728
|
+
* The name of the SVG images.
|
|
729
|
+
* @default '[name].[contenthash:10].svg'
|
|
730
|
+
*/ svg?: Rspack.AssetModuleFilename;
|
|
731
|
+
/**
|
|
732
|
+
* The name of the font files.
|
|
733
|
+
* @default '[name].[contenthash:10][ext]'
|
|
734
|
+
*/ font?: Rspack.AssetModuleFilename;
|
|
735
|
+
/**
|
|
736
|
+
* The name of non-SVG images.
|
|
737
|
+
* @default '[name].[contenthash:10][ext]'
|
|
738
|
+
*/ image?: Rspack.AssetModuleFilename;
|
|
739
|
+
/**
|
|
740
|
+
* The name of media assets, such as video.
|
|
741
|
+
* @default '[name].[contenthash:10][ext]'
|
|
742
|
+
*/ media?: Rspack.AssetModuleFilename;
|
|
743
|
+
/**
|
|
744
|
+
* The name of Wasm files.
|
|
745
|
+
* @default '[hash].module.wasm'
|
|
746
|
+
*/ wasm?: Rspack.WebassemblyModuleFilename;
|
|
747
|
+
/**
|
|
748
|
+
* The name of other assets, except for above (image, svg, font, html, wasm...)
|
|
749
|
+
* @default '[name].[contenthash:10][ext]'
|
|
750
|
+
*/ assets?: Rspack.AssetModuleFilename;
|
|
859
751
|
};
|
|
860
752
|
export type FilenameHash = boolean | string | {
|
|
861
753
|
/**
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
*/
|
|
873
|
-
format?: string;
|
|
754
|
+
* Controls whether to add filename hash.
|
|
755
|
+
* - `true`: JavaScript and CSS filenames include hash in production mode.
|
|
756
|
+
* - `false`: Disable filename hash.
|
|
757
|
+
* - `'always'`: JavaScript and CSS filenames include hash in all modes.
|
|
758
|
+
* @default true
|
|
759
|
+
*/ enable?: boolean | 'always';
|
|
760
|
+
/**
|
|
761
|
+
* The filename hash format.
|
|
762
|
+
* @default 'contenthash:10'
|
|
763
|
+
*/ format?: string;
|
|
874
764
|
};
|
|
875
765
|
export type DataUriLimit = {
|
|
876
766
|
/**
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* The data URI limit of other static assets.
|
|
898
|
-
* @default 4096
|
|
899
|
-
*/
|
|
900
|
-
assets?: number;
|
|
767
|
+
* The data URI limit of the SVG image.
|
|
768
|
+
* @default 4096
|
|
769
|
+
*/ svg?: number;
|
|
770
|
+
/**
|
|
771
|
+
* The data URI limit of the font file.
|
|
772
|
+
* @default 4096
|
|
773
|
+
*/ font?: number;
|
|
774
|
+
/**
|
|
775
|
+
* The data URI limit of non-SVG images.
|
|
776
|
+
* @default 4096
|
|
777
|
+
*/ image?: number;
|
|
778
|
+
/**
|
|
779
|
+
* The data URI limit of media resources such as videos.
|
|
780
|
+
* @default 4096
|
|
781
|
+
*/ media?: number;
|
|
782
|
+
/**
|
|
783
|
+
* The data URI limit of other static assets.
|
|
784
|
+
* @default 4096
|
|
785
|
+
*/ assets?: number;
|
|
901
786
|
};
|
|
902
787
|
export type Charset = 'ascii' | 'utf8';
|
|
903
788
|
export type LegalComments = 'none' | 'inline' | 'linked';
|
|
@@ -905,107 +790,90 @@ export type NormalizedDataUriLimit = Required<DataUriLimit>;
|
|
|
905
790
|
export type Polyfill = 'usage' | 'entry' | 'off';
|
|
906
791
|
export type SourceMapExtractTarget = {
|
|
907
792
|
/**
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
include?: RuleSetCondition[];
|
|
793
|
+
* Include matched files whose existing source maps should be extracted.
|
|
794
|
+
*/ include?: RuleSetCondition[];
|
|
911
795
|
/**
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
exclude?: RuleSetCondition[];
|
|
796
|
+
* Exclude matched files whose existing source maps should not be extracted.
|
|
797
|
+
*/ exclude?: RuleSetCondition[];
|
|
915
798
|
};
|
|
916
799
|
export type SourceMapExtractOptions = SourceMapExtractTarget & {
|
|
917
800
|
/**
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
test?: RuleSetCondition;
|
|
801
|
+
* Custom rule condition for matching files whose existing source maps should
|
|
802
|
+
* be extracted.
|
|
803
|
+
* @default /\.(?:js|mjs|cjs|jsx)$/
|
|
804
|
+
*/ test?: RuleSetCondition;
|
|
923
805
|
/**
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
js?: boolean | SourceMapExtractTarget;
|
|
806
|
+
* Whether to extract existing source maps from matching JavaScript files.
|
|
807
|
+
* @deprecated Use the flat `test`, `include`, and `exclude` fields instead.
|
|
808
|
+
*/ js?: boolean | SourceMapExtractTarget;
|
|
928
809
|
};
|
|
929
810
|
export type SourceMapExtract = boolean | SourceMapExtractOptions;
|
|
930
811
|
export type SourceMap = {
|
|
931
812
|
/**
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
* @default false
|
|
946
|
-
*/
|
|
947
|
-
extract?: SourceMapExtract;
|
|
813
|
+
* The source map type for JavaScript files.
|
|
814
|
+
* @default isDev ? 'cheap-module-source-map' : false
|
|
815
|
+
*/ js?: Rspack.Configuration['devtool'];
|
|
816
|
+
/**
|
|
817
|
+
* Whether to generate source map for CSS files.
|
|
818
|
+
* @default false
|
|
819
|
+
*/ css?: boolean;
|
|
820
|
+
/**
|
|
821
|
+
* Whether to extract existing source maps from matching input files.
|
|
822
|
+
* This is useful when a third-party package already ships both output files
|
|
823
|
+
* and source map files.
|
|
824
|
+
* @default false
|
|
825
|
+
*/ extract?: SourceMapExtract;
|
|
948
826
|
};
|
|
949
827
|
export type CSSModulesLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
|
950
828
|
export type CSSModules = {
|
|
951
829
|
/**
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
/**
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
mode?: CSSLoaderModulesOptions['mode'];
|
|
976
|
-
/**
|
|
977
|
-
* Whether to enable ES modules named export for locals.
|
|
978
|
-
* @default false
|
|
979
|
-
*/
|
|
980
|
-
namedExport?: boolean;
|
|
830
|
+
* Allows CSS Modules to be automatically enabled based on their filenames.
|
|
831
|
+
* @default true
|
|
832
|
+
*/ auto?: CSSLoaderModulesOptions['auto'];
|
|
833
|
+
/**
|
|
834
|
+
* Allows exporting names from global class names, so you can use them via import.
|
|
835
|
+
* @default false
|
|
836
|
+
*/ exportGlobals?: boolean;
|
|
837
|
+
/**
|
|
838
|
+
* Style of exported class names.
|
|
839
|
+
* @default 'camelCase'
|
|
840
|
+
*/ exportLocalsConvention?: CSSModulesLocalsConvention;
|
|
841
|
+
/**
|
|
842
|
+
* Set the local ident name of CSS Modules.
|
|
843
|
+
* @default isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'
|
|
844
|
+
*/ localIdentName?: string;
|
|
845
|
+
/**
|
|
846
|
+
* Controls the level of compilation applied to the input styles.
|
|
847
|
+
* @default 'local'
|
|
848
|
+
*/ mode?: CSSLoaderModulesOptions['mode'];
|
|
849
|
+
/**
|
|
850
|
+
* Whether to enable ES modules named export for locals.
|
|
851
|
+
* @default false
|
|
852
|
+
*/ namedExport?: boolean;
|
|
981
853
|
};
|
|
982
854
|
export type Minify = boolean | {
|
|
983
855
|
/**
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
* Minimizer options of CSS, which will be passed to LightningCSS.
|
|
1006
|
-
* @default inherit from `tools.lightningcssLoader` config
|
|
1007
|
-
*/
|
|
1008
|
-
cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
856
|
+
* Whether to enable minification for JavaScript bundles.
|
|
857
|
+
* - `true`: Enabled in production mode.
|
|
858
|
+
* - `false`: Disabled in all modes.
|
|
859
|
+
* - `'always'`: Enabled in all modes.
|
|
860
|
+
* @default true
|
|
861
|
+
*/ js?: boolean | 'always';
|
|
862
|
+
/**
|
|
863
|
+
* Minimizer options of JavaScript, which will be passed to SWC.
|
|
864
|
+
* @default {}
|
|
865
|
+
*/ jsOptions?: SwcJsMinimizerRspackPluginOptions;
|
|
866
|
+
/**
|
|
867
|
+
* Whether to enable minification for CSS bundles.
|
|
868
|
+
* - `true`: Enabled in production mode.
|
|
869
|
+
* - `false`: Disabled in all modes.
|
|
870
|
+
* - `'always'`: Enabled in all modes.
|
|
871
|
+
* @default true
|
|
872
|
+
*/ css?: boolean | 'always';
|
|
873
|
+
/**
|
|
874
|
+
* Minimizer options of CSS, which will be passed to LightningCSS.
|
|
875
|
+
* @default inherit from `tools.lightningcssLoader` config
|
|
876
|
+
*/ cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
1009
877
|
};
|
|
1010
878
|
export type InlineChunkTestFunction = (params: {
|
|
1011
879
|
size: number;
|
|
@@ -1018,273 +886,239 @@ export type InlineChunkConfig = boolean | InlineChunkTest | {
|
|
|
1018
886
|
};
|
|
1019
887
|
export type ManifestByEntry = {
|
|
1020
888
|
/**
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
/** Initial
|
|
1025
|
-
js?: string[];
|
|
1026
|
-
/** Initial CSS files for this entry. */
|
|
1027
|
-
css?: string[];
|
|
889
|
+
* Files that are required during the initial load of the entry.
|
|
890
|
+
*/ initial?: {
|
|
891
|
+
/** Initial JavaScript files for this entry. */ js?: string[];
|
|
892
|
+
/** Initial CSS files for this entry. */ css?: string[];
|
|
1028
893
|
};
|
|
1029
894
|
/**
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
/** Async
|
|
1035
|
-
js?: string[];
|
|
1036
|
-
/** Async CSS files for this entry. */
|
|
1037
|
-
css?: string[];
|
|
895
|
+
* Files that may be loaded asynchronously.
|
|
896
|
+
* Usually code-split chunks or lazily loaded chunks.
|
|
897
|
+
*/ async?: {
|
|
898
|
+
/** Async JavaScript files for this entry. */ js?: string[];
|
|
899
|
+
/** Async CSS files for this entry. */ css?: string[];
|
|
1038
900
|
};
|
|
1039
|
-
/** HTML files generated for this entry, if any. */
|
|
1040
|
-
html?: string[];
|
|
901
|
+
/** HTML files generated for this entry, if any. */ html?: string[];
|
|
1041
902
|
/**
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
assets?: string[];
|
|
903
|
+
* Additional assets associated with this entry.
|
|
904
|
+
* For example images、fonts、source maps and other non JS or CSS files.
|
|
905
|
+
*/ assets?: string[];
|
|
1046
906
|
};
|
|
1047
907
|
export type ManifestData = {
|
|
1048
908
|
/**
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
allFiles: string[];
|
|
909
|
+
* A flat list of all emitted asset files.
|
|
910
|
+
*/ allFiles: string[];
|
|
1052
911
|
/**
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
entries: Record<string, ManifestByEntry>;
|
|
912
|
+
* Maps each entry name to its associated output files.
|
|
913
|
+
*/ entries: Record<string, ManifestByEntry>;
|
|
1056
914
|
/**
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
integrity: Record<string, string>;
|
|
915
|
+
* Subresource Integrity (SRI) hashes for emitted assets.
|
|
916
|
+
* The key is the asset file path, and the value is its integrity hash.
|
|
917
|
+
* This field is available only when the `security.sri` option is enabled.
|
|
918
|
+
*/ integrity: Record<string, string>;
|
|
1062
919
|
};
|
|
1063
920
|
export type ManifestObjectConfig = {
|
|
1064
921
|
/**
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
filename?: string;
|
|
922
|
+
* The filename or path of the manifest file.
|
|
923
|
+
* The manifest file will be emitted to the output directory.
|
|
924
|
+
* @default 'manifest.json'
|
|
925
|
+
*/ filename?: string;
|
|
1070
926
|
/**
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
generate?: (params: {
|
|
927
|
+
* A custom function to generate the content of the manifest file.
|
|
928
|
+
*/ generate?: (params: {
|
|
1074
929
|
files: FileDescriptor[];
|
|
1075
930
|
manifestData: ManifestData;
|
|
1076
931
|
}) => Record<string, unknown>;
|
|
1077
932
|
/**
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
*/
|
|
1089
|
-
prefix?: boolean;
|
|
933
|
+
* Allows you to filter the files included in the manifest.
|
|
934
|
+
* The function receives a `file` parameter and returns `true` to keep the file,
|
|
935
|
+
* or `false` to exclude it.
|
|
936
|
+
* @default (file: FileDescriptor) => !file.name.endsWith('.LICENSE.txt')
|
|
937
|
+
*/ filter?: (file: FileDescriptor) => boolean;
|
|
938
|
+
/**
|
|
939
|
+
* Controls whether the generated manifest includes the static asset prefix in file paths.
|
|
940
|
+
* The prefix is taken from `dev.assetPrefix` and `output.assetPrefix`.
|
|
941
|
+
* @default true
|
|
942
|
+
*/ prefix?: boolean;
|
|
1090
943
|
};
|
|
1091
944
|
export type ManifestConfig = string | boolean | ManifestObjectConfig;
|
|
1092
945
|
export type CleanDistPathObject = {
|
|
1093
946
|
/**
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
enable?: boolean | 'auto';
|
|
947
|
+
* Whether to clean up all files under the output directory before the build starts.
|
|
948
|
+
* @default 'auto'
|
|
949
|
+
*/ enable?: boolean | 'auto';
|
|
1098
950
|
/**
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
keep?: RegExp[];
|
|
951
|
+
* Specify the files to keep in the output directory.
|
|
952
|
+
* If the file's absolute path matches the regular expression in `keep`, the file
|
|
953
|
+
* will not be removed.
|
|
954
|
+
* @default undefined
|
|
955
|
+
*/ keep?: RegExp[];
|
|
1105
956
|
};
|
|
1106
957
|
export type CleanDistPath = boolean | 'auto' | CleanDistPathObject;
|
|
958
|
+
export type AutoExternalExclude = OneOrMany<string | RegExp>;
|
|
1107
959
|
export type AutoExternal = boolean | {
|
|
1108
960
|
/**
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
961
|
+
* Whether to automatically externalize dependencies of type `dependencies`.
|
|
962
|
+
* @default true
|
|
963
|
+
*/ dependencies?: boolean;
|
|
964
|
+
/**
|
|
965
|
+
* Whether to automatically externalize dependencies of type `optionalDependencies`.
|
|
966
|
+
* @default true
|
|
967
|
+
*/ optionalDependencies?: boolean;
|
|
968
|
+
/**
|
|
969
|
+
* Whether to automatically externalize dependencies of type `peerDependencies`.
|
|
970
|
+
* @default true
|
|
971
|
+
*/ peerDependencies?: boolean;
|
|
972
|
+
/**
|
|
973
|
+
* Whether to automatically externalize dependencies of type `devDependencies`.
|
|
974
|
+
* @default false
|
|
975
|
+
*/ devDependencies?: boolean;
|
|
976
|
+
/**
|
|
977
|
+
* Specify the package.json file path(s) used to collect dependencies.
|
|
978
|
+
* Relative paths are resolved from the Rsbuild root directory.
|
|
979
|
+
* @default '<root>/package.json'
|
|
980
|
+
*/ packageJson?: string | string[];
|
|
981
|
+
/**
|
|
982
|
+
* Prevent matched packages from being automatically externalized.
|
|
983
|
+
* Strings match package names exactly, and regular expressions test package names.
|
|
984
|
+
* @default undefined
|
|
985
|
+
*/ exclude?: AutoExternalExclude;
|
|
1128
986
|
};
|
|
1129
987
|
export interface OutputConfig {
|
|
1130
988
|
/**
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
/**
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
* [Lightning CSS](https://github.com/parcel-bundler/lightningcss) to identify
|
|
1265
|
-
* the JavaScript syntax that need to be transformed and the CSS browser prefixes
|
|
1266
|
-
* that need to be added.
|
|
1267
|
-
* @default undefined
|
|
1268
|
-
*/
|
|
1269
|
-
overrideBrowserslist?: string[];
|
|
1270
|
-
/**
|
|
1271
|
-
* Copies the specified file or directory to the dist directory.
|
|
1272
|
-
* @default undefined
|
|
1273
|
-
*/
|
|
1274
|
-
copy?: CopyRspackPluginOptions | CopyRspackPluginOptions['patterns'];
|
|
1275
|
-
/**
|
|
1276
|
-
* Whether to emit static assets such as image, font, etc.
|
|
1277
|
-
* Return `false` to avoid outputting unnecessary assets for some scenarios such as SSR.
|
|
1278
|
-
* @default true
|
|
1279
|
-
*/
|
|
1280
|
-
emitAssets?: boolean;
|
|
1281
|
-
/**
|
|
1282
|
-
* Whether to emit CSS to the output bundles.
|
|
1283
|
-
* If `false`, the CSS will not be extracted to separate files or injected into the
|
|
1284
|
-
* JavaScript bundles via `output.injectStyles`.
|
|
1285
|
-
* @default `true` when `output.target` is `web`, otherwise `false`
|
|
1286
|
-
*/
|
|
1287
|
-
emitCss?: boolean;
|
|
989
|
+
* Setting the build target for Rsbuild.
|
|
990
|
+
* @default 'web'
|
|
991
|
+
*/ target?: RsbuildTarget;
|
|
992
|
+
/**
|
|
993
|
+
* Use this option to specify which modules should not be bundled by Rsbuild, and instead
|
|
994
|
+
* use implementations provided by the external environment.
|
|
995
|
+
* For more information, please see: [Rspack Externals](https://rspack.rs/config/externals)
|
|
996
|
+
* @default undefined
|
|
997
|
+
*/ externals?: Externals;
|
|
998
|
+
/**
|
|
999
|
+
* Automatically externalize dependencies declared in the root package.json.
|
|
1000
|
+
* This option will generate `externals` rules for matching dependencies and their subpath imports.
|
|
1001
|
+
* @default false
|
|
1002
|
+
*/ autoExternal?: AutoExternal;
|
|
1003
|
+
/**
|
|
1004
|
+
* Set the directory of the output files.
|
|
1005
|
+
* Rsbuild will emit files to the specified subdirectory according to the file type.
|
|
1006
|
+
* - `string`: Set the root output directory to a specific path, equivalent to `distPath.root`.
|
|
1007
|
+
* - `object`: Set the output directory for each file type.
|
|
1008
|
+
*/ distPath?: string | DistPathConfig;
|
|
1009
|
+
/**
|
|
1010
|
+
* Sets the filename of output files.
|
|
1011
|
+
*/ filename?: FilenameConfig;
|
|
1012
|
+
/**
|
|
1013
|
+
* Specify the character encoding format for output files.
|
|
1014
|
+
* Can be `ascii` or `utf8`.
|
|
1015
|
+
* @default 'utf8'
|
|
1016
|
+
*/ charset?: Charset;
|
|
1017
|
+
/**
|
|
1018
|
+
* Configure how the polyfill is injected.
|
|
1019
|
+
* @default 'off'
|
|
1020
|
+
*/ polyfill?: Polyfill;
|
|
1021
|
+
/**
|
|
1022
|
+
* When using CDN in the production,
|
|
1023
|
+
* you can use this option to set the URL prefix of static assets,
|
|
1024
|
+
* similar to the `output.publicPath` config of Rspack.
|
|
1025
|
+
* `auto` means use a relative path based on file location.
|
|
1026
|
+
* @default `server.base`
|
|
1027
|
+
*/ assetPrefix?: LiteralUnion<'auto', string>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Set the size threshold to inline static assets such as images and fonts.
|
|
1030
|
+
* By default, static assets will be Base64 encoded and inline into the page if
|
|
1031
|
+
* the size is less than 4KiB.
|
|
1032
|
+
* @default { svg: 4096, font: 4096, image: 4096, media: 4096, assets: 4096 }
|
|
1033
|
+
*/ dataUriLimit?: number | DataUriLimit;
|
|
1034
|
+
/**
|
|
1035
|
+
* Configure how to handle the legal comment.
|
|
1036
|
+
* A "legal comment" is considered to be any statement-level comment in JS or rule-level
|
|
1037
|
+
* comment in CSS that contains @license or @preserve or that starts with //! or /\*!.
|
|
1038
|
+
* These comments are preserved in output files by default since that follows the intent
|
|
1039
|
+
* of the original authors of the code.
|
|
1040
|
+
* @default 'linked'
|
|
1041
|
+
*/ legalComments?: LegalComments;
|
|
1042
|
+
/**
|
|
1043
|
+
* Whether to clean up all files under the output directory before the build starts.
|
|
1044
|
+
* @default 'auto'
|
|
1045
|
+
*/ cleanDistPath?: CleanDistPath;
|
|
1046
|
+
/**
|
|
1047
|
+
* Allow to custom CSS Modules options.
|
|
1048
|
+
*/ cssModules?: CSSModules;
|
|
1049
|
+
/**
|
|
1050
|
+
* Configure whether to enable code minification in production mode, or to configure
|
|
1051
|
+
* minimizer options.
|
|
1052
|
+
* @default true
|
|
1053
|
+
*/ minify?: Minify;
|
|
1054
|
+
/**
|
|
1055
|
+
* Configure how to generate the manifest file.
|
|
1056
|
+
* - `true`: Generate a manifest file named `manifest.json` in the output directory.
|
|
1057
|
+
* - `false`: Do not generate the manifest file.
|
|
1058
|
+
* - `string`: Generate a manifest file with the specified filename or path.
|
|
1059
|
+
* - `object`: Generate a manifest file with the specified options.
|
|
1060
|
+
* @default false
|
|
1061
|
+
*/ manifest?: ManifestConfig;
|
|
1062
|
+
/**
|
|
1063
|
+
* Whether to output JavaScript files in ES modules format.
|
|
1064
|
+
* @default true when `output.target` is `node`, otherwise `false`
|
|
1065
|
+
*/ module?: boolean;
|
|
1066
|
+
/**
|
|
1067
|
+
* Whether to generate source map files, and which format of source map to generate.
|
|
1068
|
+
*
|
|
1069
|
+
* @default
|
|
1070
|
+
* ```js
|
|
1071
|
+
* const defaultSourceMap = {
|
|
1072
|
+
* js: isDev ? 'cheap-module-source-map' : false,
|
|
1073
|
+
* css: false,
|
|
1074
|
+
* extract: false,
|
|
1075
|
+
* };
|
|
1076
|
+
* ```
|
|
1077
|
+
*/ sourceMap?: boolean | SourceMap;
|
|
1078
|
+
/**
|
|
1079
|
+
* Whether to add filename hash.
|
|
1080
|
+
* - `true`: JavaScript and CSS filenames include hash in production mode, while other assets
|
|
1081
|
+
* always include hash in all modes.
|
|
1082
|
+
* - `false`: Disable filename hash.
|
|
1083
|
+
* - `string`: Enable filename hash and customize the hash format, such as `'contenthash:16'`.
|
|
1084
|
+
* - `object`: An object to configure filename hash behavior.
|
|
1085
|
+
* @default true
|
|
1086
|
+
*/ filenameHash?: FilenameHash;
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether to inline output scripts files (.js files) into HTML with `<script>` tags.
|
|
1089
|
+
* @default false
|
|
1090
|
+
*/ inlineScripts?: InlineChunkConfig;
|
|
1091
|
+
/**
|
|
1092
|
+
* Whether to inline output style files (.css files) into html with `<style>` tags.
|
|
1093
|
+
* @default false
|
|
1094
|
+
*/ inlineStyles?: InlineChunkConfig;
|
|
1095
|
+
/**
|
|
1096
|
+
* Whether to inject styles into the DOM via `style-loader`.
|
|
1097
|
+
* @default false
|
|
1098
|
+
*/ injectStyles?: boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* Specifies the range of target browsers that the project is compatible with.
|
|
1101
|
+
* This value will be used by [SWC](https://github.com/swc-project/swc) and
|
|
1102
|
+
* [Lightning CSS](https://github.com/parcel-bundler/lightningcss) to identify
|
|
1103
|
+
* the JavaScript syntax that need to be transformed and the CSS browser prefixes
|
|
1104
|
+
* that need to be added.
|
|
1105
|
+
* @default undefined
|
|
1106
|
+
*/ overrideBrowserslist?: string[];
|
|
1107
|
+
/**
|
|
1108
|
+
* Copies the specified file or directory to the dist directory.
|
|
1109
|
+
* @default undefined
|
|
1110
|
+
*/ copy?: CopyRspackPluginOptions | CopyRspackPluginOptions['patterns'];
|
|
1111
|
+
/**
|
|
1112
|
+
* Whether to emit static assets such as image, font, etc.
|
|
1113
|
+
* Return `false` to avoid outputting unnecessary assets for some scenarios such as SSR.
|
|
1114
|
+
* @default true
|
|
1115
|
+
*/ emitAssets?: boolean;
|
|
1116
|
+
/**
|
|
1117
|
+
* Whether to emit CSS to the output bundles.
|
|
1118
|
+
* If `false`, the CSS will not be extracted to separate files or injected into the
|
|
1119
|
+
* JavaScript bundles via `output.injectStyles`.
|
|
1120
|
+
* @default `true` when `output.target` is `web`, otherwise `false`
|
|
1121
|
+
*/ emitCss?: boolean;
|
|
1288
1122
|
}
|
|
1289
1123
|
export interface NormalizedOutputConfig extends OutputConfig {
|
|
1290
1124
|
target: RsbuildTarget;
|
|
@@ -1328,8 +1162,7 @@ export type OutputStructure = 'flat' | 'nested';
|
|
|
1328
1162
|
* name: 'viewport',
|
|
1329
1163
|
* content: 'width=500, initial-scale=1',
|
|
1330
1164
|
* }
|
|
1331
|
-
*/
|
|
1332
|
-
export type MetaAttrs = Record<string, string | boolean>;
|
|
1165
|
+
*/ export type MetaAttrs = Record<string, string | boolean>;
|
|
1333
1166
|
/**
|
|
1334
1167
|
* Meta options in name-content form.
|
|
1335
1168
|
* Key is the meta name, such as `viewport`, `description`, or `robots`.
|
|
@@ -1344,88 +1177,79 @@ export type MetaAttrs = Record<string, string | boolean>;
|
|
|
1344
1177
|
* description: 'My awesome website',
|
|
1345
1178
|
* robots: false,
|
|
1346
1179
|
* }
|
|
1347
|
-
*/
|
|
1348
|
-
export type MetaOptions = Record<string, string | false | MetaAttrs>;
|
|
1180
|
+
*/ export type MetaOptions = Record<string, string | false | MetaAttrs>;
|
|
1349
1181
|
export type HtmlBasicTag = {
|
|
1350
1182
|
/**
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
* `metadata` does not affect the generated HTML content.
|
|
1389
|
-
* @default undefined
|
|
1390
|
-
*/
|
|
1391
|
-
metadata?: Record<string, any>;
|
|
1183
|
+
* The HTML tag name to be generated. Should be a valid HTML element name.
|
|
1184
|
+
* @example
|
|
1185
|
+
* - `'script'` for JavaScript files
|
|
1186
|
+
* - `'link'` for stylesheets or external resources
|
|
1187
|
+
* - `'meta'` for metadata
|
|
1188
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
1189
|
+
*/ tag: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* HTML attributes to be applied to the tag.
|
|
1192
|
+
* - `string` values will be rendered as `attribute="value"`
|
|
1193
|
+
* - `true` renders as boolean attribute (e.g., `<input disabled>`)
|
|
1194
|
+
* - `false` or `null` or `undefined` values will omit the attribute
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* // String attributes
|
|
1198
|
+
* attrs: {
|
|
1199
|
+
* src: 'https://example.com/script.js',
|
|
1200
|
+
* type: 'text/javascript',
|
|
1201
|
+
* }
|
|
1202
|
+
* // Result: <script src="https://example.com/script.js" type="text/javascript">
|
|
1203
|
+
|
|
1204
|
+
* // Boolean attributes
|
|
1205
|
+
* attrs: {
|
|
1206
|
+
* async: true, // <script async>
|
|
1207
|
+
* defer: false, // attribute omitted
|
|
1208
|
+
* }
|
|
1209
|
+
* // Result: <script async>
|
|
1210
|
+
*/ attrs?: Record<string, string | boolean | null | undefined>;
|
|
1211
|
+
/**
|
|
1212
|
+
* The innerHTML content of the tag. The content is inserted as-is without
|
|
1213
|
+
* HTML escaping, so ensure it's safe to prevent XSS vulnerabilities.
|
|
1214
|
+
*/ children?: string;
|
|
1215
|
+
/**
|
|
1216
|
+
* The metadata object for tags, used to store additional information about tags.
|
|
1217
|
+
* `metadata` does not affect the generated HTML content.
|
|
1218
|
+
* @default undefined
|
|
1219
|
+
*/ metadata?: Record<string, any>;
|
|
1392
1220
|
};
|
|
1393
1221
|
export type HtmlTag = HtmlBasicTag & {
|
|
1394
1222
|
/**
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
* @default Auto-detect: `true` for head-allowed elements, `false` otherwise
|
|
1426
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head#see_also
|
|
1427
|
-
*/
|
|
1428
|
-
head?: boolean;
|
|
1223
|
+
* Controls whether to add a hash query parameter to asset URLs for cache invalidation.
|
|
1224
|
+
* Only affects the `src` attribute of the `script` tag and the `href` attribute of the `link` tag.
|
|
1225
|
+
* - `false`: No hash query
|
|
1226
|
+
* - `true`: Generate hash based on HTML content
|
|
1227
|
+
* - `string`: Uses a custom hash string
|
|
1228
|
+
* - `function`: Custom hash generation via a function
|
|
1229
|
+
* @default false
|
|
1230
|
+
*/ hash?: boolean | string | ((url: string, hash: string) => string);
|
|
1231
|
+
/**
|
|
1232
|
+
* Controls whether to prepend the asset prefix to resource URLs.
|
|
1233
|
+
* Only affects the `src` attribute of the `script` tag and the `href` attribute of the `link` tag.
|
|
1234
|
+
* - `true`: Prepends asset prefix to the URL
|
|
1235
|
+
* - `false`: Uses the URL as-is
|
|
1236
|
+
* - `string`: Uses a custom prefix
|
|
1237
|
+
* - `function`: Custom path transformation via a function
|
|
1238
|
+
* @default true
|
|
1239
|
+
*/ publicPath?: boolean | string | ((url: string, publicPath: string) => string);
|
|
1240
|
+
/**
|
|
1241
|
+
* Defines the injection position relative to existing tags.
|
|
1242
|
+
* - `true`: Insert after existing tags
|
|
1243
|
+
* - `false`: Insert before existing tags
|
|
1244
|
+
* @default true
|
|
1245
|
+
*/ append?: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Specifies whether to inject the tag into the HTML `<head>` element.
|
|
1248
|
+
* - `true`: Inject into `<head>`
|
|
1249
|
+
* - `false`: Inject into `<body>`
|
|
1250
|
+
* @default Auto-detect: `true` for head-allowed elements, `false` otherwise
|
|
1251
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head#see_also
|
|
1252
|
+
*/ head?: boolean;
|
|
1429
1253
|
};
|
|
1430
1254
|
export type HtmlTagContext = {
|
|
1431
1255
|
hash: string;
|
|
@@ -1435,156 +1259,137 @@ export type HtmlTagContext = {
|
|
|
1435
1259
|
};
|
|
1436
1260
|
export type HtmlTagHandler = (tags: HtmlTag[], context: HtmlTagContext) => HtmlTag[] | void;
|
|
1437
1261
|
export type HtmlTagDescriptor = HtmlTag | HtmlTagHandler;
|
|
1438
|
-
type ChainedHtmlOption<O> =
|
|
1262
|
+
type ChainedHtmlOption<O> = OneOrMany<O | ((context: {
|
|
1263
|
+
value: O;
|
|
1439
1264
|
entryName: string;
|
|
1440
|
-
}>;
|
|
1265
|
+
}) => MaybePromise<O | void>)>;
|
|
1441
1266
|
export type AppIconItem = {
|
|
1442
1267
|
/**
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
* the default value.
|
|
1469
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/icons#purpose
|
|
1470
|
-
*/
|
|
1471
|
-
purpose?: LiteralUnion<'any' | 'maskable' | 'monochrome', string>;
|
|
1268
|
+
* The path to the icon, can be a URL, an absolute file path,
|
|
1269
|
+
* or a relative path to the project root.
|
|
1270
|
+
*/ src: string;
|
|
1271
|
+
/**
|
|
1272
|
+
* The size of the icon.
|
|
1273
|
+
*/ size: number;
|
|
1274
|
+
/**
|
|
1275
|
+
* Specifies the intended target for which the icon should be generated.
|
|
1276
|
+
* - `apple-touch-icon` for iOS system.
|
|
1277
|
+
* - `web-app-manifest` for web application manifest.
|
|
1278
|
+
*/ target?: 'apple-touch-icon' | 'web-app-manifest';
|
|
1279
|
+
/**
|
|
1280
|
+
* A case-sensitive keyword string that specifies one or more contexts in
|
|
1281
|
+
* which the icon can be used by the browser or operating system.
|
|
1282
|
+
* This field is only effective when the `target` is `'web-app-manifest'`.
|
|
1283
|
+
*
|
|
1284
|
+
* The possible properties include:
|
|
1285
|
+
* - `'monochrome'`: Indicates that the icon is intended to be used as a
|
|
1286
|
+
* monochrome icon with a solid fill.
|
|
1287
|
+
* - `'maskable'`: Indicates that the icon is designed with icon masks and
|
|
1288
|
+
* safe zone in mind.
|
|
1289
|
+
* - `'any'`: Indicates that the icon can be used in any context. This is
|
|
1290
|
+
* the default value.
|
|
1291
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/icons#purpose
|
|
1292
|
+
*/ purpose?: LiteralUnion<'any' | 'maskable' | 'monochrome', string>;
|
|
1472
1293
|
};
|
|
1473
1294
|
export type AppIcon = {
|
|
1474
1295
|
/**
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
name?: string;
|
|
1296
|
+
* The name of the application.
|
|
1297
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest/name
|
|
1298
|
+
*/ name?: string;
|
|
1479
1299
|
/**
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
icons: AppIconItem[];
|
|
1300
|
+
* The list of icons.
|
|
1301
|
+
*/ icons: AppIconItem[];
|
|
1483
1302
|
/**
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
filename?: string;
|
|
1303
|
+
* The filename of the manifest file.
|
|
1304
|
+
* @default 'manifest.webmanifest'
|
|
1305
|
+
*/ filename?: string;
|
|
1488
1306
|
};
|
|
1489
1307
|
type HtmlImplementation = 'js' | 'native';
|
|
1490
1308
|
export interface HtmlConfig {
|
|
1491
1309
|
/**
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
/**
|
|
1554
|
-
* Define the path to the HTML template,
|
|
1555
|
-
* corresponding to the `template` config of [html-rspack-plugin](https://github.com/rstackjs/html-rspack-plugin).
|
|
1556
|
-
* @default A built-in HTML template
|
|
1557
|
-
*/
|
|
1558
|
-
template?: ChainedHtmlOption<string>;
|
|
1559
|
-
/**
|
|
1560
|
-
* Define the parameters in the HTML template,
|
|
1561
|
-
* corresponding to the `templateParameters` config of [html-rspack-plugin](https://github.com/rstackjs/html-rspack-plugin).
|
|
1562
|
-
*/
|
|
1563
|
-
templateParameters?: ConfigChainWithContext<Record<string, unknown>, {
|
|
1310
|
+
* Configure the `<meta>` tag of the HTML.
|
|
1311
|
+
*
|
|
1312
|
+
* @default
|
|
1313
|
+
* ```js
|
|
1314
|
+
* const defaultMeta = {
|
|
1315
|
+
* charset: { charset: 'utf-8' },
|
|
1316
|
+
* viewport: 'width=device-width, initial-scale=1.0',
|
|
1317
|
+
* };
|
|
1318
|
+
* ```
|
|
1319
|
+
*/ meta?: ChainedHtmlOption<MetaOptions>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Set the title tag of the HTML page.
|
|
1322
|
+
* @default 'Rsbuild App'
|
|
1323
|
+
*/ title?: ChainedHtmlOption<string>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Set the inject position of the `<script>` tag.
|
|
1326
|
+
* @default 'head'
|
|
1327
|
+
*/ inject?: ChainedHtmlOption<ScriptInject>;
|
|
1328
|
+
/**
|
|
1329
|
+
* Inject custom html tags into the output html files.
|
|
1330
|
+
* @default undefined
|
|
1331
|
+
*/ tags?: OneOrMany<HtmlTagDescriptor>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Set the favicon icon for all pages.
|
|
1334
|
+
* @default undefined
|
|
1335
|
+
*/ favicon?: ChainedHtmlOption<string>;
|
|
1336
|
+
/**
|
|
1337
|
+
* Set the web application icons to display when added to the home screen of a mobile device.
|
|
1338
|
+
*
|
|
1339
|
+
* @default undefined
|
|
1340
|
+
* @example
|
|
1341
|
+
* appIcon: {
|
|
1342
|
+
* name: 'My Website',
|
|
1343
|
+
* icons: [
|
|
1344
|
+
* { src: './icon-192.png', size: 192 },
|
|
1345
|
+
* { src: './icon-512.png', size: 512 },
|
|
1346
|
+
* ]
|
|
1347
|
+
* }
|
|
1348
|
+
*/ appIcon?: AppIcon;
|
|
1349
|
+
/**
|
|
1350
|
+
* Set the id of root element.
|
|
1351
|
+
* @default 'root'
|
|
1352
|
+
*/ mountId?: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* Set the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) attribute
|
|
1355
|
+
* of the `<script>` tag.
|
|
1356
|
+
* @default false
|
|
1357
|
+
*/ crossorigin?: boolean | CrossOrigin;
|
|
1358
|
+
/**
|
|
1359
|
+
* Define the directory structure of the HTML output files.
|
|
1360
|
+
* @default 'flat'
|
|
1361
|
+
*/ outputStructure?: OutputStructure;
|
|
1362
|
+
/**
|
|
1363
|
+
* Define the path to the HTML template,
|
|
1364
|
+
* corresponding to the `template` config of [html-rspack-plugin](https://github.com/rstackjs/html-rspack-plugin).
|
|
1365
|
+
* @default A built-in HTML template
|
|
1366
|
+
*/ template?: ChainedHtmlOption<string>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Define the parameters in the HTML template,
|
|
1369
|
+
* corresponding to the `templateParameters` config of [html-rspack-plugin](https://github.com/rstackjs/html-rspack-plugin).
|
|
1370
|
+
*/ templateParameters?: ConfigChainAsyncWithContext<Record<string, unknown>, {
|
|
1564
1371
|
entryName: string;
|
|
1565
1372
|
}>;
|
|
1566
1373
|
/**
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
*/
|
|
1587
|
-
implementation?: HtmlImplementation;
|
|
1374
|
+
* Specifies how `<script>` tags generated by Rsbuild are loaded.
|
|
1375
|
+
* - `'defer'`: Adds the `defer` attribute so scripts load in parallel and run after
|
|
1376
|
+
* the document has been parsed.
|
|
1377
|
+
* - `'module'`: Adds `type="module"` to enable ES modules semantics.
|
|
1378
|
+
* - `'blocking'`: No `defer` or `async`, scripts execute immediately in order.
|
|
1379
|
+
* @default 'defer'. If `output.module` is enabled, the value is always `'module'`.
|
|
1380
|
+
*/ scriptLoading?: ScriptLoading;
|
|
1381
|
+
/**
|
|
1382
|
+
* Specifies which implementation to use for generating HTML files.
|
|
1383
|
+
*
|
|
1384
|
+
* - `'js'` (default) - Use the JavaScript-based `html-rspack-plugin`.
|
|
1385
|
+
* - `'native'` - Use Rspack's built-in `HtmlRspackPlugin` implemented in Rust.
|
|
1386
|
+
*
|
|
1387
|
+
* This option is experimental and may affect the available options in `tools.htmlPlugin`,
|
|
1388
|
+
* since the two implementations are not fully compatible.
|
|
1389
|
+
*
|
|
1390
|
+
* @default 'js'
|
|
1391
|
+
* @experimental
|
|
1392
|
+
*/ implementation?: HtmlImplementation;
|
|
1588
1393
|
}
|
|
1589
1394
|
export type NormalizedHtmlConfig = HtmlConfig & {
|
|
1590
1395
|
meta: ChainedHtmlOption<MetaOptions>;
|
|
@@ -1603,29 +1408,24 @@ export type RequestHandler = Connect.NextHandleFunction;
|
|
|
1603
1408
|
export type EnvironmentAPI = Record<string, {
|
|
1604
1409
|
/**
|
|
1605
1410
|
* Get stats info about current environment.
|
|
1606
|
-
*/
|
|
1607
|
-
getStats: () => Promise<Rspack.Stats>;
|
|
1411
|
+
*/ getStats: () => Promise<Rspack.Stats>;
|
|
1608
1412
|
/**
|
|
1609
1413
|
* Load and execute stats bundle in Server.
|
|
1610
1414
|
*
|
|
1611
1415
|
* @param entryName - relate to rsbuild source.entry
|
|
1612
1416
|
* @returns the return of entry module.
|
|
1613
|
-
*/
|
|
1614
|
-
loadBundle: <T = unknown>(entryName: string) => Promise<T>;
|
|
1417
|
+
*/ loadBundle: <T = unknown>(entryName: string) => Promise<T>;
|
|
1615
1418
|
/**
|
|
1616
1419
|
* Get the compiled HTML template.
|
|
1617
|
-
*/
|
|
1618
|
-
getTransformedHtml: (entryName: string) => Promise<string>;
|
|
1420
|
+
*/ getTransformedHtml: (entryName: string) => Promise<string>;
|
|
1619
1421
|
/**
|
|
1620
1422
|
* Send HMR message to the current environment only.
|
|
1621
|
-
*/
|
|
1622
|
-
hot: {
|
|
1423
|
+
*/ hot: {
|
|
1623
1424
|
send: HotSend;
|
|
1624
1425
|
};
|
|
1625
1426
|
/**
|
|
1626
1427
|
* Provides some context information about the current environment
|
|
1627
|
-
*/
|
|
1628
|
-
context: EnvironmentContext;
|
|
1428
|
+
*/ context: EnvironmentContext;
|
|
1629
1429
|
}>;
|
|
1630
1430
|
export type SetupMiddlewaresContext = Pick<RsbuildDevServer, 'sockWrite' | 'environments'>;
|
|
1631
1431
|
export type SetupMiddlewaresFn = (middlewares: {
|
|
@@ -1634,106 +1434,89 @@ export type SetupMiddlewaresFn = (middlewares: {
|
|
|
1634
1434
|
}, server: SetupMiddlewaresContext) => void;
|
|
1635
1435
|
export type OverlayOptions = {
|
|
1636
1436
|
/**
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
*/
|
|
1649
|
-
runtime?: boolean | ((error: Error) => boolean);
|
|
1437
|
+
* Whether to show build errors in the overlay. You can pass a filter
|
|
1438
|
+
* function to control which formatted build errors are rendered.
|
|
1439
|
+
* Return false from the filter function to hide a specific error.
|
|
1440
|
+
* @default true
|
|
1441
|
+
*/ errors?: boolean | ((error: Error) => boolean);
|
|
1442
|
+
/**
|
|
1443
|
+
* Whether to show runtime errors in the overlay. You can pass a filter
|
|
1444
|
+
* function to control which runtime errors are rendered.
|
|
1445
|
+
* Return false from the filter function to hide a specific error.
|
|
1446
|
+
* @default false
|
|
1447
|
+
*/ runtime?: boolean | ((error: Error) => boolean);
|
|
1650
1448
|
};
|
|
1651
1449
|
export type ClientConfig = {
|
|
1652
1450
|
/**
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
/**
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
*/
|
|
1681
|
-
overlay?: boolean | OverlayOptions;
|
|
1682
|
-
/**
|
|
1683
|
-
* Controls the log level for client-side logging in the browser console.
|
|
1684
|
-
* @default 'info'
|
|
1685
|
-
*/
|
|
1686
|
-
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
1451
|
+
* The path for the WebSocket request.
|
|
1452
|
+
* @default '/rsbuild-hmr'
|
|
1453
|
+
*/ path?: string;
|
|
1454
|
+
/**
|
|
1455
|
+
* The port number for the WebSocket request.
|
|
1456
|
+
* @default location.port
|
|
1457
|
+
*/ port?: string | number;
|
|
1458
|
+
/**
|
|
1459
|
+
* The host for the WebSocket request.
|
|
1460
|
+
* @default location.hostname
|
|
1461
|
+
*/ host?: string;
|
|
1462
|
+
/**
|
|
1463
|
+
* The protocol name for the WebSocket request.
|
|
1464
|
+
* @default location.protocol === 'https:' ? 'wss' : 'ws'
|
|
1465
|
+
*/ protocol?: 'ws' | 'wss';
|
|
1466
|
+
/**
|
|
1467
|
+
* The maximum number of reconnection attempts after a WebSocket request is disconnected.
|
|
1468
|
+
* @default 100
|
|
1469
|
+
*/ reconnect?: number;
|
|
1470
|
+
/**
|
|
1471
|
+
* Whether to display an error overlay in the browser.
|
|
1472
|
+
* @default true
|
|
1473
|
+
*/ overlay?: boolean | OverlayOptions;
|
|
1474
|
+
/**
|
|
1475
|
+
* Controls the log level for client-side logging in the browser console.
|
|
1476
|
+
* @default 'info'
|
|
1477
|
+
*/ logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
1687
1478
|
};
|
|
1688
1479
|
export type NormalizedClientConfig = Optional<Required<ClientConfig>, 'protocol'>;
|
|
1689
1480
|
export type { ChokidarOptions };
|
|
1690
1481
|
export type WatchFiles = {
|
|
1691
1482
|
/**
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
paths: string | string[];
|
|
1483
|
+
* Paths of the files or directories to watch, supports glob syntax.
|
|
1484
|
+
*/ paths: string | string[];
|
|
1695
1485
|
/**
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
options?: ChokidarOptions;
|
|
1486
|
+
* Watch options passed to [chokidar](https://github.com/paulmillr/chokidar).
|
|
1487
|
+
*/ options?: ChokidarOptions;
|
|
1699
1488
|
/**
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
type?: 'reload-page' | 'reload-server';
|
|
1489
|
+
* Specifies whether to reload the page or restart the dev server when files change.
|
|
1490
|
+
* @default 'reload-page'
|
|
1491
|
+
*/ type?: 'reload-page' | 'reload-server';
|
|
1704
1492
|
};
|
|
1705
1493
|
export type CliShortcut = {
|
|
1706
1494
|
/**
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
key: string;
|
|
1495
|
+
* The key to trigger the shortcut.
|
|
1496
|
+
*/ key: string;
|
|
1710
1497
|
/**
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
description: string;
|
|
1498
|
+
* The description of the shortcut.
|
|
1499
|
+
*/ description: string;
|
|
1714
1500
|
/**
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
action: () => void | Promise<void>;
|
|
1501
|
+
* The action to execute when the shortcut is triggered.
|
|
1502
|
+
*/ action: () => void | Promise<void>;
|
|
1718
1503
|
};
|
|
1719
1504
|
export type WriteToDisk = boolean | ((filename: string) => boolean);
|
|
1720
1505
|
export type BrowserLogsStackTrace = 'summary' | 'full' | 'none';
|
|
1721
1506
|
export type LiveReload = boolean | {
|
|
1722
1507
|
/**
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
html?: boolean;
|
|
1508
|
+
* Whether to trigger a full page reload when the HTML template changes.
|
|
1509
|
+
* @default true
|
|
1510
|
+
*/ html?: boolean;
|
|
1727
1511
|
};
|
|
1728
1512
|
export interface DevConfig {
|
|
1729
1513
|
/**
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
browserLogs?: boolean | {
|
|
1514
|
+
* Controls whether to forward browser runtime errors to the terminal. When `true`, the dev
|
|
1515
|
+
* client listens for `window.error` events and unhandled Promise rejections in the browser,
|
|
1516
|
+
* then sends them to the dev server where they are printed in the terminal (prefixed with
|
|
1517
|
+
* `[browser]`).
|
|
1518
|
+
* @default { stackTrace: 'summary' }
|
|
1519
|
+
*/ browserLogs?: boolean | {
|
|
1737
1520
|
/**
|
|
1738
1521
|
* Controls how the error stack trace is displayed in the terminal when forwarding
|
|
1739
1522
|
* browser errors.
|
|
@@ -1741,77 +1524,64 @@ export interface DevConfig {
|
|
|
1741
1524
|
* - `'full'` – Print the full stack trace with all frames.
|
|
1742
1525
|
* - `'none'` – Hide stack traces.
|
|
1743
1526
|
* @default 'summary'
|
|
1744
|
-
*/
|
|
1745
|
-
stackTrace?: BrowserLogsStackTrace;
|
|
1527
|
+
*/ stackTrace?: BrowserLogsStackTrace;
|
|
1746
1528
|
};
|
|
1747
1529
|
/**
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
client?: ClientConfig;
|
|
1773
|
-
/**
|
|
1774
|
-
* Whether to enable CLI shortcuts.
|
|
1775
|
-
* @default true when using Rsbuild CLI, otherwise false
|
|
1776
|
-
*/
|
|
1777
|
-
cliShortcuts?: boolean | {
|
|
1530
|
+
* Whether to enable Hot Module Replacement.
|
|
1531
|
+
* @default true
|
|
1532
|
+
*/ hmr?: boolean;
|
|
1533
|
+
/**
|
|
1534
|
+
* Whether to reload the page when file changes are detected.
|
|
1535
|
+
* @default true
|
|
1536
|
+
*/ liveReload?: LiveReload;
|
|
1537
|
+
/**
|
|
1538
|
+
* Set the URL prefix of static assets in development mode,
|
|
1539
|
+
* similar to the [output.publicPath](https://rspack.rs/config/output#outputpublicpath)
|
|
1540
|
+
* config of Rspack.
|
|
1541
|
+
* @default `server.base`
|
|
1542
|
+
*/ assetPrefix?: LiteralUnion<'auto', string> | boolean;
|
|
1543
|
+
/**
|
|
1544
|
+
* Whether to render progress bars to display the build progress.
|
|
1545
|
+
* @default false
|
|
1546
|
+
*/ progressBar?: boolean | ProgressBarConfig;
|
|
1547
|
+
/**
|
|
1548
|
+
* Config for Rsbuild client code.
|
|
1549
|
+
*/ client?: ClientConfig;
|
|
1550
|
+
/**
|
|
1551
|
+
* Whether to enable CLI shortcuts.
|
|
1552
|
+
* @default true when using Rsbuild CLI, otherwise false
|
|
1553
|
+
*/ cliShortcuts?: boolean | {
|
|
1778
1554
|
/**
|
|
1779
1555
|
* Customize the CLI shortcuts.
|
|
1780
1556
|
* @param shortcuts - The default CLI shortcuts.
|
|
1781
1557
|
* @returns - The customized CLI shortcuts.
|
|
1782
|
-
*/
|
|
1783
|
-
custom?: (shortcuts: CliShortcut[]) => CliShortcut[];
|
|
1558
|
+
*/ custom?: (shortcuts: CliShortcut[]) => CliShortcut[];
|
|
1784
1559
|
/**
|
|
1785
1560
|
* Whether to print the help hint when the server is started.
|
|
1786
1561
|
* - `true`: Print the default help hint.
|
|
1787
1562
|
* - `false`: Disable the help hint.
|
|
1788
1563
|
* - `string`: Print a custom help hint.
|
|
1789
1564
|
* @default true
|
|
1790
|
-
*/
|
|
1791
|
-
help?: boolean | string;
|
|
1565
|
+
*/ help?: boolean | string;
|
|
1792
1566
|
};
|
|
1793
1567
|
/**
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
* Enable lazy compilation (compilation on demand).
|
|
1812
|
-
* @default { imports: true, entries: false }
|
|
1813
|
-
*/
|
|
1814
|
-
lazyCompilation?: boolean | Rspack.LazyCompilationOptions;
|
|
1568
|
+
* Used to add custom middleware to the dev server.
|
|
1569
|
+
* @deprecated Use `server.setup` instead
|
|
1570
|
+
* @default undefined
|
|
1571
|
+
*/ setupMiddlewares?: SetupMiddlewaresFn | SetupMiddlewaresFn[];
|
|
1572
|
+
/**
|
|
1573
|
+
* Controls whether the build output from development mode is written to disk.
|
|
1574
|
+
* @default false
|
|
1575
|
+
*/ writeToDisk?: WriteToDisk;
|
|
1576
|
+
/**
|
|
1577
|
+
* Watch specified files and directories for changes. When a file change is detected,
|
|
1578
|
+
* it can trigger a page reload or restart the dev server.
|
|
1579
|
+
* @default undefined
|
|
1580
|
+
*/ watchFiles?: WatchFiles | WatchFiles[];
|
|
1581
|
+
/**
|
|
1582
|
+
* Enable lazy compilation (compilation on demand).
|
|
1583
|
+
* @default { imports: true, entries: false }
|
|
1584
|
+
*/ lazyCompilation?: boolean | Rspack.LazyCompilationOptions;
|
|
1815
1585
|
}
|
|
1816
1586
|
export type NormalizedDevConfig = Omit<DevConfig, 'watchFiles'> & Required<Pick<DevConfig, 'hmr' | 'liveReload' | 'assetPrefix' | 'writeToDisk' | 'cliShortcuts' | 'browserLogs'>> & {
|
|
1817
1587
|
watchFiles: WatchFiles[];
|
|
@@ -1819,48 +1589,42 @@ export type NormalizedDevConfig = Omit<DevConfig, 'watchFiles'> & Required<Pick<
|
|
|
1819
1589
|
};
|
|
1820
1590
|
export interface ResolveConfig {
|
|
1821
1591
|
/**
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
* when resolving an npm package's entry point.
|
|
1859
|
-
* @default
|
|
1860
|
-
* - If `output.target` is `'web'`, `'web-worker'`, or not specified, the default value is `["browser", "module", "main"]`.
|
|
1861
|
-
* - If `output.target` is `'node'`, the default value is `["module", "main"]`.
|
|
1862
|
-
*/
|
|
1863
|
-
mainFields?: string[];
|
|
1592
|
+
* Force Rsbuild to resolve the specified packages from project root,
|
|
1593
|
+
* which is useful for deduplicating packages and reducing the bundle size.
|
|
1594
|
+
*/ dedupe?: string[];
|
|
1595
|
+
/**
|
|
1596
|
+
* Set the alias for the module path, which is used to simplify the import path or
|
|
1597
|
+
* redirect the module reference.
|
|
1598
|
+
* Similar to the [resolve.alias](https://rspack.rs/config/resolve) config of Rspack.
|
|
1599
|
+
* @default { '@swc/helpers': path.dirname(require.resolve('@swc/helpers/package.json')) }
|
|
1600
|
+
*/ alias?: ConfigChain<Alias>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Set the strategy for path alias resolution, to control the priority relationship
|
|
1603
|
+
* between the `paths` option in `tsconfig.json` and the `resolve.alias` option of Rsbuild.
|
|
1604
|
+
* - `prefer-tsconfig`: The `paths` option in `tsconfig.json` will take precedence over the
|
|
1605
|
+
* `resolve.alias` option of Rsbuild.
|
|
1606
|
+
* - `prefer-alias`: The `resolve.alias` option of Rsbuild will take precedence over the
|
|
1607
|
+
* `paths` option in `tsconfig.json`.
|
|
1608
|
+
* @default 'prefer-tsconfig'
|
|
1609
|
+
*/ aliasStrategy?: AliasStrategy;
|
|
1610
|
+
/**
|
|
1611
|
+
* Automatically resolve file extensions when importing modules.
|
|
1612
|
+
* This means you can import files without explicitly writing their extensions.
|
|
1613
|
+
* @default ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json']
|
|
1614
|
+
*/ extensions?: string[];
|
|
1615
|
+
/**
|
|
1616
|
+
* Specifies the condition names used to match entry points in the exports field
|
|
1617
|
+
* of a package.
|
|
1618
|
+
* @default Inherits from Rspack. See https://rspack.rs/config/resolve#resolveconditionnames
|
|
1619
|
+
*/ conditionNames?: string[];
|
|
1620
|
+
/**
|
|
1621
|
+
* Controls the priority of fields in a package.json used to locate a package's
|
|
1622
|
+
* entry file. It is the ordered list of package.json fields Rspack will try
|
|
1623
|
+
* when resolving an npm package's entry point.
|
|
1624
|
+
* @default
|
|
1625
|
+
* - If `output.target` is `'web'`, `'web-worker'`, or not specified, the default value is `["browser", "module", "main"]`.
|
|
1626
|
+
* - If `output.target` is `'node'`, the default value is `["module", "main"]`.
|
|
1627
|
+
*/ mainFields?: string[];
|
|
1864
1628
|
}
|
|
1865
1629
|
export type NormalizedResolveConfig = ResolveConfig & Pick<Required<ResolveConfig>, 'alias' | 'aliasStrategy' | 'extensions'>;
|
|
1866
1630
|
export type ModuleFederationConfig = {
|
|
@@ -1869,115 +1633,92 @@ export type ModuleFederationConfig = {
|
|
|
1869
1633
|
export type NormalizedModuleFederationConfig = ModuleFederationConfig;
|
|
1870
1634
|
export type RsbuildConfigMeta = {
|
|
1871
1635
|
/**
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
configFilePath: string;
|
|
1636
|
+
* Path to the rsbuild config file.
|
|
1637
|
+
*/ configFilePath: string;
|
|
1875
1638
|
};
|
|
1876
1639
|
/**
|
|
1877
1640
|
* Only some dev options can be defined in the environment config
|
|
1878
|
-
*/
|
|
1879
|
-
export type AllowedEnvironmentDevKeys = 'hmr' | 'client' | 'liveReload' | 'browserLogs' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk';
|
|
1641
|
+
*/ export type AllowedEnvironmentDevKeys = 'hmr' | 'client' | 'liveReload' | 'browserLogs' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk';
|
|
1880
1642
|
/**
|
|
1881
1643
|
* The Rsbuild config to run in the specified environment.
|
|
1882
|
-
*/
|
|
1883
|
-
export interface EnvironmentConfig {
|
|
1644
|
+
*/ export interface EnvironmentConfig {
|
|
1884
1645
|
/**
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
dev?: Pick<DevConfig, AllowedEnvironmentDevKeys>;
|
|
1646
|
+
* Options for local development.
|
|
1647
|
+
*/ dev?: Pick<DevConfig, AllowedEnvironmentDevKeys>;
|
|
1888
1648
|
/**
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
html?: HtmlConfig;
|
|
1649
|
+
* Options for HTML generation.
|
|
1650
|
+
*/ html?: HtmlConfig;
|
|
1892
1651
|
/**
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
tools?: ToolsConfig;
|
|
1652
|
+
* Options for the low-level tools.
|
|
1653
|
+
*/ tools?: ToolsConfig;
|
|
1896
1654
|
/**
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
resolve?: ResolveConfig;
|
|
1655
|
+
* Options for module resolution.
|
|
1656
|
+
*/ resolve?: ResolveConfig;
|
|
1900
1657
|
/**
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
source?: SourceConfig;
|
|
1658
|
+
* Options for input source code.
|
|
1659
|
+
*/ source?: SourceConfig;
|
|
1904
1660
|
/**
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
output?: OutputConfig;
|
|
1661
|
+
* Options for build outputs.
|
|
1662
|
+
*/ output?: OutputConfig;
|
|
1908
1663
|
/**
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
security?: SecurityConfig;
|
|
1664
|
+
* Options for Web security.
|
|
1665
|
+
*/ security?: SecurityConfig;
|
|
1912
1666
|
/**
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
performance?: PerformanceConfig;
|
|
1667
|
+
* Options for build performance and runtime performance.
|
|
1668
|
+
*/ performance?: PerformanceConfig;
|
|
1916
1669
|
/**
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
splitChunks?: SplitChunksConfig | false;
|
|
1670
|
+
* Options for chunk splitting.
|
|
1671
|
+
*/ splitChunks?: SplitChunksConfig | false;
|
|
1920
1672
|
/**
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
moduleFederation?: ModuleFederationConfig;
|
|
1673
|
+
* Options for module federation.
|
|
1674
|
+
*/ moduleFederation?: ModuleFederationConfig;
|
|
1924
1675
|
/**
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
plugins?: RsbuildPlugins;
|
|
1676
|
+
* Configure Rsbuild plugins.
|
|
1677
|
+
*/ plugins?: RsbuildPlugins;
|
|
1928
1678
|
}
|
|
1929
1679
|
export type LogLevel = 'info' | 'warn' | 'error' | 'silent';
|
|
1930
1680
|
/**
|
|
1931
1681
|
* The Rsbuild config.
|
|
1932
|
-
*/
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
* Configure Rsbuild config by environment.
|
|
1973
|
-
* The key represents the environment name.
|
|
1974
|
-
* The value is the Rsbuild config for the specified environment.
|
|
1975
|
-
*/
|
|
1976
|
-
environments?: Record<string, EnvironmentConfig>;
|
|
1977
|
-
/**
|
|
1978
|
-
* @private
|
|
1979
|
-
*/
|
|
1980
|
-
_privateMeta?: RsbuildConfigMeta;
|
|
1682
|
+
*/ export interface RsbuildConfig extends EnvironmentConfig {
|
|
1683
|
+
/**
|
|
1684
|
+
* Specify the build mode for Rsbuild, as each mode has different default behavior and optimizations.
|
|
1685
|
+
* @default Depends on `process.env.NODE_ENV`:
|
|
1686
|
+
* - `'production'` if NODE_ENV is 'production'
|
|
1687
|
+
* - `'development'` if NODE_ENV is 'development'
|
|
1688
|
+
* - otherwise `'none'`
|
|
1689
|
+
*/ mode?: RsbuildMode;
|
|
1690
|
+
/**
|
|
1691
|
+
* Specify the project root directory. Can be an absolute path, or a path relative to `process.cwd()`.
|
|
1692
|
+
* @default `process.cwd()`
|
|
1693
|
+
*/ root?: string;
|
|
1694
|
+
/**
|
|
1695
|
+
* Specify the log level of Rsbuild.
|
|
1696
|
+
* - 'info': Output all logs.
|
|
1697
|
+
* - 'warn': Output `warn` and `error` level logs.
|
|
1698
|
+
* - 'error': Output `error` level logs.
|
|
1699
|
+
* - 'silent': Do not output any logs.
|
|
1700
|
+
* @default 'info'
|
|
1701
|
+
*/ logLevel?: LogLevel;
|
|
1702
|
+
/**
|
|
1703
|
+
* Use a custom logger instance for the current Rsbuild instance.
|
|
1704
|
+
* You can create one via `createLogger()`.
|
|
1705
|
+
*/ customLogger?: Logger;
|
|
1706
|
+
/**
|
|
1707
|
+
* Options for local development.
|
|
1708
|
+
*/ dev?: DevConfig;
|
|
1709
|
+
/**
|
|
1710
|
+
* Options for the Rsbuild server.
|
|
1711
|
+
* Mainly applies to local development and preview.
|
|
1712
|
+
* Some options (e.g. `publicDir`, `base`) also affect production builds.
|
|
1713
|
+
*/ server?: ServerConfig;
|
|
1714
|
+
/**
|
|
1715
|
+
* Configure Rsbuild config by environment.
|
|
1716
|
+
* The key represents the environment name.
|
|
1717
|
+
* The value is the Rsbuild config for the specified environment.
|
|
1718
|
+
*/ environments?: Record<string, EnvironmentConfig>;
|
|
1719
|
+
/**
|
|
1720
|
+
* @private
|
|
1721
|
+
*/ _privateMeta?: RsbuildConfigMeta;
|
|
1981
1722
|
}
|
|
1982
1723
|
export type MergedEnvironmentConfig = {
|
|
1983
1724
|
mode: RsbuildMode;
|
|
@@ -1998,8 +1739,7 @@ export type MergedEnvironmentConfig = {
|
|
|
1998
1739
|
};
|
|
1999
1740
|
/**
|
|
2000
1741
|
* The normalized Rsbuild environment config.
|
|
2001
|
-
*/
|
|
2002
|
-
export type NormalizedEnvironmentConfig = TwoLevelReadonly<Omit<MergedEnvironmentConfig, 'dev'> & {
|
|
1742
|
+
*/ export type NormalizedEnvironmentConfig = TwoLevelReadonly<Omit<MergedEnvironmentConfig, 'dev'> & {
|
|
2003
1743
|
dev: NormalizedDevConfig;
|
|
2004
1744
|
server: NormalizedServerConfig;
|
|
2005
1745
|
_privateMeta?: RsbuildConfigMeta;
|