@lynx-js/rspeedy 0.13.6 → 0.14.1
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/CHANGELOG.md +20 -0
- package/dist/0~src_config_validate_ts.js +1485 -1427
- package/dist/0~src_plugins_minify_plugin_ts.js +92 -21
- package/dist/1~src_config_validate_ts.js +1485 -1427
- package/dist/1~src_plugins_minify_plugin_ts.js +95 -21
- package/dist/index.d.ts +275 -141
- package/dist/src_cli_main_ts.js +1 -1
- package/dist/src_index_ts.js +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -75,20 +75,7 @@ export declare interface BuildCache {
|
|
|
75
75
|
* An array of files containing build dependencies.
|
|
76
76
|
* Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
77
77
|
*
|
|
78
|
-
* @
|
|
79
|
-
*
|
|
80
|
-
* Rspeedy will use the following configuration files as the default build dependencies:
|
|
81
|
-
*
|
|
82
|
-
* - `package.json`
|
|
83
|
-
*
|
|
84
|
-
* - `tsconfig.json` (or `source.tsconfigPath`)
|
|
85
|
-
*
|
|
86
|
-
* - `.env`, `.env.*`
|
|
87
|
-
*
|
|
88
|
-
* - `tailwindcss.config.*`
|
|
89
|
-
*
|
|
90
|
-
* When using Rspeedy CLI, it will also automatically add
|
|
91
|
-
* `lynx.config.js` to the build dependencies.
|
|
78
|
+
* @defaultValue `['package.json', 'tsconfig.json' (or source.tsconfigPath), '.env', '.env.*', 'tailwindcss.config.*']`; when using the Rspeedy CLI with `performance.buildCache` enabled, the loaded `lynx.config.*` file is also added.
|
|
92
79
|
*
|
|
93
80
|
* @example
|
|
94
81
|
*
|
|
@@ -118,9 +105,11 @@ export declare interface ChunkSplit {
|
|
|
118
105
|
/**
|
|
119
106
|
* The ChunkSplitting strategy.
|
|
120
107
|
*
|
|
108
|
+
* @defaultValue In Rsbuild's default chunk splitting behavior, the strategy is `'split-by-experience'`.
|
|
109
|
+
*
|
|
121
110
|
* @remarks
|
|
122
111
|
*
|
|
123
|
-
* - `split-by-experience`(default): an empirical splitting strategy, automatically splits some commonly used npm packages into chunks of moderate size.
|
|
112
|
+
* - `split-by-experience`(Rsbuild default): an empirical splitting strategy, automatically splits some commonly used npm packages into chunks of moderate size.
|
|
124
113
|
*
|
|
125
114
|
* - `split-by-module`: split by NPM package granularity, each NPM package corresponds to a chunk.
|
|
126
115
|
*
|
|
@@ -168,6 +157,8 @@ export declare interface ChunkSplit {
|
|
|
168
157
|
/**
|
|
169
158
|
* Custom Rspack chunk splitting config can be specified.
|
|
170
159
|
*
|
|
160
|
+
* @defaultValue undefined
|
|
161
|
+
*
|
|
171
162
|
* @example
|
|
172
163
|
*
|
|
173
164
|
* - Split `@lynx-js/react` and `react-router` into chunk `lib-react`.
|
|
@@ -210,7 +201,9 @@ export declare interface ChunkSplitBySize {
|
|
|
210
201
|
*/
|
|
211
202
|
strategy: 'split-by-size';
|
|
212
203
|
/**
|
|
213
|
-
* The minimum size of a chunk, unit in bytes.
|
|
204
|
+
* The minimum size of a chunk, unit in bytes.
|
|
205
|
+
*
|
|
206
|
+
* @defaultValue 10000
|
|
214
207
|
*
|
|
215
208
|
* @example
|
|
216
209
|
*
|
|
@@ -229,7 +222,9 @@ export declare interface ChunkSplitBySize {
|
|
|
229
222
|
*/
|
|
230
223
|
minSize?: number | undefined;
|
|
231
224
|
/**
|
|
232
|
-
* The maximum size of a chunk, unit in bytes.
|
|
225
|
+
* The maximum size of a chunk, unit in bytes.
|
|
226
|
+
*
|
|
227
|
+
* @defaultValue `Number.POSITIVE_INFINITY`
|
|
233
228
|
*
|
|
234
229
|
* @example
|
|
235
230
|
*
|
|
@@ -249,6 +244,8 @@ export declare interface ChunkSplitBySize {
|
|
|
249
244
|
maxSize?: number | undefined;
|
|
250
245
|
/**
|
|
251
246
|
* {@inheritdoc ChunkSplit.override}
|
|
247
|
+
*
|
|
248
|
+
* @defaultValue undefined
|
|
252
249
|
*/
|
|
253
250
|
override?: Rspack.Configuration extends {
|
|
254
251
|
optimization?: {
|
|
@@ -270,6 +267,8 @@ export declare interface ChunkSplitCustom {
|
|
|
270
267
|
/**
|
|
271
268
|
* {@inheritdoc ChunkSplit.override}
|
|
272
269
|
*
|
|
270
|
+
* @defaultValue undefined
|
|
271
|
+
*
|
|
273
272
|
* @example
|
|
274
273
|
*
|
|
275
274
|
* - Split `@lynx-js/react` and `react-router` into chunk `lib-react`.
|
|
@@ -309,11 +308,15 @@ export declare interface ChunkSplitCustom {
|
|
|
309
308
|
export declare interface Config {
|
|
310
309
|
/**
|
|
311
310
|
* The {@link Dev} option is used to control the behavior related with development. Including: HMR, DevServer, etc.
|
|
311
|
+
*
|
|
312
|
+
* @defaultValue undefined
|
|
312
313
|
*/
|
|
313
314
|
dev?: Dev | undefined;
|
|
314
315
|
/**
|
|
315
316
|
* The {@link Config.environments} option is used to set the output environment.
|
|
316
317
|
*
|
|
318
|
+
* @defaultValue When this option is unset, Rspeedy passes `{ lynx: {} }` to Rsbuild.
|
|
319
|
+
*
|
|
317
320
|
* @remarks
|
|
318
321
|
*
|
|
319
322
|
* Normally you don't need this if you are not using Lynx for Web.
|
|
@@ -358,23 +361,7 @@ export declare interface Config {
|
|
|
358
361
|
/**
|
|
359
362
|
* Specify the build mode for Rsbuild and Rspack, as each mode has different default behavior and optimizations.
|
|
360
363
|
*
|
|
361
|
-
* @
|
|
362
|
-
*
|
|
363
|
-
* The default value of mode depends on the `process.env.NODE_ENV` environment variable:
|
|
364
|
-
*
|
|
365
|
-
* - If `NODE_ENV` is production, the default value is production.
|
|
366
|
-
*
|
|
367
|
-
* - If `NODE_ENV` is development, the default value is development.
|
|
368
|
-
*
|
|
369
|
-
* - If `NODE_ENV` has any other value, the default value is none.
|
|
370
|
-
*
|
|
371
|
-
* - If you set the value of mode, the value of `NODE_ENV` will be ignored.
|
|
372
|
-
*
|
|
373
|
-
* When using Rspeedy's CLI:
|
|
374
|
-
*
|
|
375
|
-
* - `rspeedy dev` and `rspeedy preview` will set the default values of `NODE_ENV` and `mode` to `'development'`.
|
|
376
|
-
*
|
|
377
|
-
* - `rspeedy build` will set the default values of `NODE_ENV` and `mode` to `'production'`.
|
|
364
|
+
* @defaultValue Depends on `process.env.NODE_ENV`: `'production'` when `NODE_ENV` is `'production'`, `'development'` when `NODE_ENV` is `'development'`, and `'none'` otherwise. When using Rspeedy's CLI, `rspeedy dev` and `rspeedy preview` default to `'development'`, while `rspeedy build` defaults to `'production'`.
|
|
378
365
|
*
|
|
379
366
|
* @example
|
|
380
367
|
*
|
|
@@ -415,31 +402,45 @@ export declare interface Config {
|
|
|
415
402
|
mode?: 'development' | 'production' | 'none' | undefined;
|
|
416
403
|
/**
|
|
417
404
|
* The {@link Output} option is used to set how and where should the bundles and assets output.
|
|
405
|
+
*
|
|
406
|
+
* @defaultValue undefined
|
|
418
407
|
*/
|
|
419
408
|
output?: Output | undefined;
|
|
420
409
|
/**
|
|
421
410
|
* The {@link Performance} option is used to optimize the build-time and runtime performance.
|
|
411
|
+
*
|
|
412
|
+
* @defaultValue undefined
|
|
422
413
|
*/
|
|
423
414
|
performance?: Performance | undefined;
|
|
424
415
|
/**
|
|
425
416
|
* The {@link Resolve} option is used to control the resolution behavior of Rspack.
|
|
417
|
+
*
|
|
418
|
+
* @defaultValue undefined
|
|
426
419
|
*/
|
|
427
420
|
resolve?: Resolve | undefined;
|
|
428
421
|
/**
|
|
429
422
|
* The {@link Server} option changes the behavior of dev-server.
|
|
423
|
+
*
|
|
424
|
+
* @defaultValue undefined
|
|
430
425
|
*/
|
|
431
426
|
server?: Server | undefined;
|
|
432
427
|
/**
|
|
433
428
|
* The {@link Source} option changes the behavior of source files.
|
|
429
|
+
*
|
|
430
|
+
* @defaultValue undefined
|
|
434
431
|
*/
|
|
435
432
|
source?: Source | undefined;
|
|
436
433
|
/**
|
|
437
434
|
* The {@link Tools} options changes the behavior of various building tools.
|
|
435
|
+
*
|
|
436
|
+
* @defaultValue undefined
|
|
438
437
|
*/
|
|
439
438
|
tools?: Tools | undefined;
|
|
440
439
|
/**
|
|
441
440
|
* The `plugins` option is used to customize the build process in a variety of ways.
|
|
442
441
|
*
|
|
442
|
+
* @defaultValue undefined
|
|
443
|
+
*
|
|
443
444
|
* @remarks
|
|
444
445
|
* Rspeedy use the plugin APIs from {@link https://rsbuild.dev/plugins/dev/index | Rsbuild}. See the corresponding document for developing a plugin.
|
|
445
446
|
*/
|
|
@@ -455,6 +456,8 @@ export declare interface ConfigParams {
|
|
|
455
456
|
/**
|
|
456
457
|
* The value of `process.env['NODE_ENV']`
|
|
457
458
|
*
|
|
459
|
+
* @defaultValue When `loadConfig` evaluates a config function, this value is `process.env.NODE_ENV ?? 'production'`
|
|
460
|
+
*
|
|
458
461
|
* @remarks
|
|
459
462
|
* Common values include (non-exhaustive):
|
|
460
463
|
* - `'production'`
|
|
@@ -467,6 +470,8 @@ export declare interface ConfigParams {
|
|
|
467
470
|
/**
|
|
468
471
|
* The CLI command of Rspeedy.
|
|
469
472
|
*
|
|
473
|
+
* @defaultValue When `loadConfig` evaluates a config function, this value is `process.argv[2] ?? 'build'`
|
|
474
|
+
*
|
|
470
475
|
* @remarks
|
|
471
476
|
*
|
|
472
477
|
* Possible values:
|
|
@@ -585,10 +590,14 @@ export declare interface CreateRspeedyOptions {
|
|
|
585
590
|
export declare interface CssExtract {
|
|
586
591
|
/**
|
|
587
592
|
* {@inheritdoc @lynx-js/css-extract-webpack-plugin#LoaderOptions}
|
|
593
|
+
*
|
|
594
|
+
* @defaultValue undefined
|
|
588
595
|
*/
|
|
589
596
|
loaderOptions?: CssExtractRspackLoaderOptions | undefined;
|
|
590
597
|
/**
|
|
591
598
|
* {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions}
|
|
599
|
+
*
|
|
600
|
+
* @defaultValue undefined
|
|
592
601
|
*/
|
|
593
602
|
pluginOptions?: CssExtractRspackPluginOptions | undefined;
|
|
594
603
|
}
|
|
@@ -632,6 +641,8 @@ export declare interface CssExtractRspackLoaderOptions {
|
|
|
632
641
|
* ```
|
|
633
642
|
*
|
|
634
643
|
* @public
|
|
644
|
+
*
|
|
645
|
+
* @defaultValue true
|
|
635
646
|
*/
|
|
636
647
|
esModule?: boolean | undefined;
|
|
637
648
|
}
|
|
@@ -644,10 +655,14 @@ export declare interface CssExtractRspackLoaderOptions {
|
|
|
644
655
|
export declare interface CssExtractRspackPluginOptions {
|
|
645
656
|
/**
|
|
646
657
|
* {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions.ignoreOrder}
|
|
658
|
+
*
|
|
659
|
+
* @defaultValue undefined
|
|
647
660
|
*/
|
|
648
661
|
ignoreOrder?: boolean | undefined;
|
|
649
662
|
/**
|
|
650
663
|
* {@inheritdoc @lynx-js/css-extract-webpack-plugin#CssExtractRspackPluginOptions.pathinfo}
|
|
664
|
+
*
|
|
665
|
+
* @defaultValue undefined
|
|
651
666
|
*/
|
|
652
667
|
pathinfo?: boolean | undefined;
|
|
653
668
|
}
|
|
@@ -661,13 +676,9 @@ export declare interface CssLoader {
|
|
|
661
676
|
/**
|
|
662
677
|
* The option `importLoaders` allows you to configure how many loaders before `css-loader` should be applied to `@imported` resources and CSS modules imports.
|
|
663
678
|
*
|
|
664
|
-
* @
|
|
665
|
-
*
|
|
666
|
-
* The default value of `importLoaders` is:
|
|
679
|
+
* @defaultValue `1` when compiling CSS files and `2` when compiling Sass or Less files
|
|
667
680
|
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
* - `2` when compiling Sass or Less files
|
|
681
|
+
* @remarks
|
|
671
682
|
*
|
|
672
683
|
* See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#importloaders | css-loader#import-loaders} for details.
|
|
673
684
|
*/
|
|
@@ -675,6 +686,8 @@ export declare interface CssLoader {
|
|
|
675
686
|
/**
|
|
676
687
|
* The {@link CssLoaderModules | cssLoader.modules} option enables/disables the CSS Modules specification and setup basic behavior.
|
|
677
688
|
*
|
|
689
|
+
* @defaultValue Enables CSS Modules with automatic `*.module.*` detection, camelCase exports, `namedExport: false`, and `localIdentName` inherited from `output.cssModules.localIdentName`.
|
|
690
|
+
*
|
|
678
691
|
* @example
|
|
679
692
|
*
|
|
680
693
|
* Using `false` value to increase performance because we avoid parsing CSS Modules features, it will be useful for developers who use vanilla css or use other technologies.
|
|
@@ -736,19 +749,27 @@ export declare interface CssLoader {
|
|
|
736
749
|
export declare interface CssLoaderModules {
|
|
737
750
|
/**
|
|
738
751
|
* {@inheritdoc CssModules.auto}
|
|
752
|
+
*
|
|
753
|
+
* @defaultValue true
|
|
739
754
|
*/
|
|
740
755
|
auto?: boolean | RegExp | ((filename: string) => boolean) | undefined;
|
|
741
756
|
/**
|
|
742
757
|
* {@inheritdoc CssModules.exportLocalsConvention}
|
|
758
|
+
*
|
|
759
|
+
* @defaultValue `'camelCase'`
|
|
743
760
|
*/
|
|
744
761
|
exportLocalsConvention?: CssModuleLocalsConvention | undefined;
|
|
745
762
|
/**
|
|
746
763
|
* {@inheritdoc CssModules.localIdentName}
|
|
764
|
+
*
|
|
765
|
+
* @defaultValue `'[local]-[hash:base64:6]'`
|
|
747
766
|
*/
|
|
748
767
|
localIdentName?: string | undefined;
|
|
749
768
|
/**
|
|
750
769
|
* Enables/disables ES modules named export for locals.
|
|
751
770
|
*
|
|
771
|
+
* @defaultValue false
|
|
772
|
+
*
|
|
752
773
|
* @example
|
|
753
774
|
*
|
|
754
775
|
* - `style.css`
|
|
@@ -799,6 +820,8 @@ export declare interface CssModules {
|
|
|
799
820
|
/**
|
|
800
821
|
* The `auto` option allows CSS modules to be automatically enabled based on their filenames.
|
|
801
822
|
*
|
|
823
|
+
* @defaultValue true
|
|
824
|
+
*
|
|
802
825
|
* @remarks
|
|
803
826
|
*
|
|
804
827
|
* Given the various `auto` values, the behavior is described as follows:
|
|
@@ -834,6 +857,8 @@ export declare interface CssModules {
|
|
|
834
857
|
/**
|
|
835
858
|
* Allows exporting names from global class names, so you can use them via import.
|
|
836
859
|
*
|
|
860
|
+
* @defaultValue false
|
|
861
|
+
*
|
|
837
862
|
* @remarks
|
|
838
863
|
*
|
|
839
864
|
* See {@link https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#exportglobals | css-loader#exportGlobals} for details.
|
|
@@ -842,6 +867,8 @@ export declare interface CssModules {
|
|
|
842
867
|
/**
|
|
843
868
|
* The style of exported class names.
|
|
844
869
|
*
|
|
870
|
+
* @defaultValue `'camelCase'`
|
|
871
|
+
*
|
|
845
872
|
* @remarks
|
|
846
873
|
*
|
|
847
874
|
* Given the various `exportLocalsConvention` values, the behavior is described as follows:
|
|
@@ -862,9 +889,9 @@ export declare interface CssModules {
|
|
|
862
889
|
/**
|
|
863
890
|
* Sets the format of the className generated by CSS Modules after compilation.
|
|
864
891
|
*
|
|
865
|
-
* @
|
|
892
|
+
* @defaultValue `'[local]-[hash:base64:6]'`
|
|
866
893
|
*
|
|
867
|
-
*
|
|
894
|
+
* @remarks
|
|
868
895
|
*
|
|
869
896
|
* Available placeholders:
|
|
870
897
|
*
|
|
@@ -922,6 +949,8 @@ export declare interface Decorators {
|
|
|
922
949
|
/**
|
|
923
950
|
* Specify the decorator syntax version to be used.
|
|
924
951
|
*
|
|
952
|
+
* @defaultValue `'2022-03'`
|
|
953
|
+
*
|
|
925
954
|
* @remarks
|
|
926
955
|
*
|
|
927
956
|
* If you want to know the differences between different decorators versions, you can refer to: {@link https://github.com/tc39/proposal-decorators?tab=readme-ov-file#how-does-this-proposal-compare-to-other-versions-of-decorators | How does this proposal compare to other versions of decorators?}
|
|
@@ -1091,8 +1120,13 @@ export declare function defineConfig(config: (params: ConfigParams) => Promise<C
|
|
|
1091
1120
|
export declare interface Dev {
|
|
1092
1121
|
/**
|
|
1093
1122
|
* The {@link Dev.assetPrefix} is used to set the URL prefix for static assets during development.
|
|
1123
|
+
*
|
|
1124
|
+
* @defaultValue undefined
|
|
1125
|
+
*
|
|
1094
1126
|
* @remarks
|
|
1095
1127
|
*
|
|
1128
|
+
* During `rspeedy dev`, if this option is not set to `false`, the dev plugin normalizes it to `http://<detected-host>:<port>/` and appends `server.base` when configured.
|
|
1129
|
+
*
|
|
1096
1130
|
* The functionality of {@link Dev.assetPrefix} is basically the same as the {@link https://www.rspack.dev/config/output#outputpublicpath | output.publicPath}
|
|
1097
1131
|
* config in Rspack. With the following differences:
|
|
1098
1132
|
*
|
|
@@ -1150,14 +1184,16 @@ export declare interface Dev {
|
|
|
1150
1184
|
assetPrefix?: string | boolean | undefined;
|
|
1151
1185
|
/**
|
|
1152
1186
|
* Configuration of the development client.
|
|
1187
|
+
*
|
|
1188
|
+
* @defaultValue undefined
|
|
1153
1189
|
*/
|
|
1154
1190
|
client?: DevClient | undefined;
|
|
1155
1191
|
/**
|
|
1156
1192
|
* Whether to enable Hot Module Replacement (HMR).
|
|
1157
1193
|
*
|
|
1158
|
-
* @
|
|
1194
|
+
* @defaultValue true
|
|
1159
1195
|
*
|
|
1160
|
-
*
|
|
1196
|
+
* @remarks
|
|
1161
1197
|
*
|
|
1162
1198
|
* By default, Rspeedy uses HMR as the preferred method to update modules. If HMR is disabled or cannot be used in certain scenarios, it will automatically fallback to {@link Dev.liveReload}.
|
|
1163
1199
|
*
|
|
@@ -1196,7 +1232,7 @@ export declare interface Dev {
|
|
|
1196
1232
|
/**
|
|
1197
1233
|
* Whether to enable live reload functionality.
|
|
1198
1234
|
*
|
|
1199
|
-
*
|
|
1235
|
+
* @defaultValue true
|
|
1200
1236
|
*
|
|
1201
1237
|
* Live reload is used as a fallback when {@link Dev.hmr} is disabled or cannot be used in certain scenarios. When enabled, the page will automatically refresh when source files are changed.
|
|
1202
1238
|
*
|
|
@@ -1235,6 +1271,8 @@ export declare interface Dev {
|
|
|
1235
1271
|
/**
|
|
1236
1272
|
* Watch specified files and directories for changes. When a file change is detected, it can trigger a page reload or restart the dev server.
|
|
1237
1273
|
*
|
|
1274
|
+
* @defaultValue undefined
|
|
1275
|
+
*
|
|
1238
1276
|
* @example
|
|
1239
1277
|
*
|
|
1240
1278
|
* - Specify the files and directories watched for changes.
|
|
@@ -1272,6 +1310,8 @@ export declare interface Dev {
|
|
|
1272
1310
|
/**
|
|
1273
1311
|
* Used to control whether the build artifacts of the development environment are written to the disk.
|
|
1274
1312
|
*
|
|
1313
|
+
* @defaultValue true
|
|
1314
|
+
*
|
|
1275
1315
|
* @remarks
|
|
1276
1316
|
*
|
|
1277
1317
|
* This is bypassed to {@link https://github.com/webpack/webpack-dev-middleware?tab=readme-ov-file#writetodisk | `webpack-dev-middleware`}.
|
|
@@ -1297,7 +1337,7 @@ export declare interface Dev {
|
|
|
1297
1337
|
/**
|
|
1298
1338
|
* Whether to display progress bar during compilation.
|
|
1299
1339
|
*
|
|
1300
|
-
*
|
|
1340
|
+
* @defaultValue true
|
|
1301
1341
|
*
|
|
1302
1342
|
* @example
|
|
1303
1343
|
*
|
|
@@ -1345,9 +1385,7 @@ export declare interface DevClient {
|
|
|
1345
1385
|
/**
|
|
1346
1386
|
* The path to websocket.
|
|
1347
1387
|
*
|
|
1348
|
-
* @
|
|
1349
|
-
*
|
|
1350
|
-
* Defaults to `require.resolve('@lynx-js/websocket')`
|
|
1388
|
+
* @defaultValue `require.resolve('@lynx-js/websocket')`
|
|
1351
1389
|
*/
|
|
1352
1390
|
websocketTransport?: string | undefined;
|
|
1353
1391
|
}
|
|
@@ -1365,11 +1403,7 @@ export declare interface DistPath extends DistPathConfig {
|
|
|
1365
1403
|
*
|
|
1366
1404
|
* This option is never read and will be removed in the future version.
|
|
1367
1405
|
*
|
|
1368
|
-
* @
|
|
1369
|
-
*
|
|
1370
|
-
* Default value:
|
|
1371
|
-
*
|
|
1372
|
-
* - `'.rspeedy'`
|
|
1406
|
+
* @defaultValue `'.rspeedy'`
|
|
1373
1407
|
*/
|
|
1374
1408
|
intermediate?: string | undefined;
|
|
1375
1409
|
}
|
|
@@ -1453,16 +1487,14 @@ export declare interface EntryDescription {
|
|
|
1453
1487
|
/**
|
|
1454
1488
|
* The path to the entry module(s).
|
|
1455
1489
|
*
|
|
1456
|
-
* @remarks
|
|
1457
|
-
*
|
|
1458
|
-
* If no value is provided, the default value `src/index.js` will be used.
|
|
1459
|
-
*
|
|
1460
1490
|
* @defaultValue `'./src/index.js'`
|
|
1461
1491
|
*/
|
|
1462
1492
|
import?: string | string[] | undefined;
|
|
1463
1493
|
/**
|
|
1464
1494
|
* This is an important option when using on-demand-loading or loading external resources like images, files, etc. If an incorrect value is specified you'll receive 404 errors while loading these resources.
|
|
1465
1495
|
*
|
|
1496
|
+
* @defaultValue undefined
|
|
1497
|
+
*
|
|
1466
1498
|
* @see https://webpack.js.org/configuration/output/#outputpublicpath
|
|
1467
1499
|
*/
|
|
1468
1500
|
publicPath?: string | undefined;
|
|
@@ -1522,11 +1554,9 @@ export declare interface Filename {
|
|
|
1522
1554
|
/**
|
|
1523
1555
|
* The name of the bundle files.
|
|
1524
1556
|
*
|
|
1525
|
-
* @
|
|
1526
|
-
*
|
|
1527
|
-
* Default values:
|
|
1557
|
+
* @defaultValue `'[name].[platform].bundle'`
|
|
1528
1558
|
*
|
|
1529
|
-
*
|
|
1559
|
+
* @remarks
|
|
1530
1560
|
*
|
|
1531
1561
|
* The following placeholder is supported:
|
|
1532
1562
|
*
|
|
@@ -1574,11 +1604,9 @@ export declare interface Filename {
|
|
|
1574
1604
|
*
|
|
1575
1605
|
* Use {@link Filename.bundle} instead.
|
|
1576
1606
|
*
|
|
1577
|
-
* @
|
|
1578
|
-
*
|
|
1579
|
-
* Default values:
|
|
1607
|
+
* @defaultValue `'[name].[platform].bundle'`
|
|
1580
1608
|
*
|
|
1581
|
-
*
|
|
1609
|
+
* @remarks
|
|
1582
1610
|
*
|
|
1583
1611
|
* The following placeholder is supported:
|
|
1584
1612
|
*
|
|
@@ -1621,12 +1649,7 @@ export declare interface Filename {
|
|
|
1621
1649
|
/**
|
|
1622
1650
|
* The name of the JavaScript files.
|
|
1623
1651
|
*
|
|
1624
|
-
* @
|
|
1625
|
-
*
|
|
1626
|
-
* Default values:
|
|
1627
|
-
*
|
|
1628
|
-
* - Development: `'[name].js'`
|
|
1629
|
-
* - Production: `'[name].[contenthash:8].js'`
|
|
1652
|
+
* @defaultValue `'[name].js'` in development, `'[name].[contenthash:8].js'` in production web builds, and `'[name].js'` in production node builds
|
|
1630
1653
|
*
|
|
1631
1654
|
* @example
|
|
1632
1655
|
*
|
|
@@ -1655,11 +1678,7 @@ export declare interface Filename {
|
|
|
1655
1678
|
/**
|
|
1656
1679
|
* The name of the CSS files.
|
|
1657
1680
|
*
|
|
1658
|
-
* @
|
|
1659
|
-
*
|
|
1660
|
-
* Default values:
|
|
1661
|
-
*
|
|
1662
|
-
* - `'[name].css'`
|
|
1681
|
+
* @defaultValue `'[name]/[name].css'`
|
|
1663
1682
|
*
|
|
1664
1683
|
* @example
|
|
1665
1684
|
*
|
|
@@ -1688,61 +1707,37 @@ export declare interface Filename {
|
|
|
1688
1707
|
/**
|
|
1689
1708
|
* The name of the SVG images.
|
|
1690
1709
|
*
|
|
1691
|
-
* @
|
|
1692
|
-
*
|
|
1693
|
-
* Default values:
|
|
1694
|
-
*
|
|
1695
|
-
* - `'[name].[contenthash:8].svg'`
|
|
1710
|
+
* @defaultValue `'[name].[contenthash:8].svg'`
|
|
1696
1711
|
*/
|
|
1697
1712
|
svg?: Rspack.AssetModuleFilename | undefined;
|
|
1698
1713
|
/**
|
|
1699
1714
|
* The name of the font files.
|
|
1700
1715
|
*
|
|
1701
|
-
* @
|
|
1702
|
-
*
|
|
1703
|
-
* Default values:
|
|
1704
|
-
*
|
|
1705
|
-
* - `'[name].[contenthash:8][ext]'`
|
|
1716
|
+
* @defaultValue `'[name].[contenthash:8][ext]'`
|
|
1706
1717
|
*/
|
|
1707
1718
|
font?: Rspack.AssetModuleFilename | undefined;
|
|
1708
1719
|
/**
|
|
1709
1720
|
* The name of non-SVG images.
|
|
1710
1721
|
*
|
|
1711
|
-
* @
|
|
1712
|
-
*
|
|
1713
|
-
* Default values:
|
|
1714
|
-
*
|
|
1715
|
-
* - `'[name].[contenthash:8][ext]'`
|
|
1722
|
+
* @defaultValue `'[name].[contenthash:8][ext]'`
|
|
1716
1723
|
*/
|
|
1717
1724
|
image?: Rspack.AssetModuleFilename | undefined;
|
|
1718
1725
|
/**
|
|
1719
1726
|
* The name of media assets, such as video.
|
|
1720
1727
|
*
|
|
1721
|
-
* @
|
|
1722
|
-
*
|
|
1723
|
-
* Default values:
|
|
1724
|
-
*
|
|
1725
|
-
* - `'[name].[contenthash:8][ext]'`
|
|
1728
|
+
* @defaultValue `'[name].[contenthash:8][ext]'`
|
|
1726
1729
|
*/
|
|
1727
1730
|
media?: Rspack.AssetModuleFilename | undefined;
|
|
1728
1731
|
/**
|
|
1729
1732
|
* The name of WebAssembly files.
|
|
1730
1733
|
*
|
|
1731
|
-
* @
|
|
1732
|
-
*
|
|
1733
|
-
* Default values:
|
|
1734
|
-
*
|
|
1735
|
-
* - `'[hash].module.wasm'`
|
|
1734
|
+
* @defaultValue `'[contenthash:8].module.wasm'`
|
|
1736
1735
|
*/
|
|
1737
1736
|
wasm?: Rspack.WebassemblyModuleFilename;
|
|
1738
1737
|
/**
|
|
1739
1738
|
* The name of other assets, except for above (image, svg, font, html, wasm...)
|
|
1740
1739
|
*
|
|
1741
|
-
* @
|
|
1742
|
-
*
|
|
1743
|
-
* Default values:
|
|
1744
|
-
*
|
|
1745
|
-
* - `'[name].[contenthash:8][ext]'`
|
|
1740
|
+
* @defaultValue `'[name].[contenthash:8][ext]'`
|
|
1746
1741
|
*/
|
|
1747
1742
|
assets?: Rspack.AssetModuleFilename;
|
|
1748
1743
|
}
|
|
@@ -1774,7 +1769,17 @@ export declare function loadConfig(loadConfigOptions: LoadConfigOptions): Promis
|
|
|
1774
1769
|
* @public
|
|
1775
1770
|
*/
|
|
1776
1771
|
export declare interface LoadConfigOptions {
|
|
1772
|
+
/**
|
|
1773
|
+
* The config file path to load.
|
|
1774
|
+
*
|
|
1775
|
+
* @defaultValue Automatically resolves `lynx.config.ts`, `lynx.config.js`, `lynx.config.mts`, or `lynx.config.mjs` from `cwd`
|
|
1776
|
+
*/
|
|
1777
1777
|
configPath?: string | undefined;
|
|
1778
|
+
/**
|
|
1779
|
+
* The working directory used to resolve the config path.
|
|
1780
|
+
*
|
|
1781
|
+
* @defaultValue `process.cwd()`
|
|
1782
|
+
*/
|
|
1778
1783
|
cwd?: string | undefined;
|
|
1779
1784
|
}
|
|
1780
1785
|
|
|
@@ -1845,6 +1850,8 @@ export declare interface Minify {
|
|
|
1845
1850
|
/**
|
|
1846
1851
|
* Whether enable the CSS minification.
|
|
1847
1852
|
*
|
|
1853
|
+
* @defaultValue When `output.minify` is enabled and `css` is unset, this defaults to `true`.
|
|
1854
|
+
*
|
|
1848
1855
|
* @remarks
|
|
1849
1856
|
*
|
|
1850
1857
|
* When building for production, {@link https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer | @rsbuild/plugin-css-minimizer} is used to minify CSS assets for better transmission efficiency.
|
|
@@ -1869,6 +1876,8 @@ export declare interface Minify {
|
|
|
1869
1876
|
/**
|
|
1870
1877
|
* Whether enable the JavaScript minification.
|
|
1871
1878
|
*
|
|
1879
|
+
* @defaultValue When `output.minify` is enabled and `js` is unset, this defaults to `true`.
|
|
1880
|
+
*
|
|
1872
1881
|
* @example
|
|
1873
1882
|
*
|
|
1874
1883
|
* - Disable the JavaScript minification.
|
|
@@ -1889,6 +1898,8 @@ export declare interface Minify {
|
|
|
1889
1898
|
/**
|
|
1890
1899
|
* {@link Minify.jsOptions} is used to configure SWC minification options.
|
|
1891
1900
|
*
|
|
1901
|
+
* @defaultValue When JavaScript minification is enabled and `jsOptions` is unset, this defaults to `{}`.
|
|
1902
|
+
*
|
|
1892
1903
|
* @remarks
|
|
1893
1904
|
*
|
|
1894
1905
|
* For detailed configurations, please refer to {@link https://rspack.dev/plugins/rspack/swc-js-minimizer-rspack-plugin | SwcJsMinimizerRspackPlugin}.
|
|
@@ -1914,6 +1925,59 @@ export declare interface Minify {
|
|
|
1914
1925
|
* ```
|
|
1915
1926
|
*/
|
|
1916
1927
|
jsOptions?: Rspack.SwcJsMinimizerRspackPluginOptions | undefined;
|
|
1928
|
+
/**
|
|
1929
|
+
* {@link Minify.mainThreadOptions} is used to override
|
|
1930
|
+
* {@link Minify.jsOptions} for main-thread bundles.
|
|
1931
|
+
*
|
|
1932
|
+
* @defaultValue undefined
|
|
1933
|
+
*
|
|
1934
|
+
* @remarks
|
|
1935
|
+
*
|
|
1936
|
+
* This option is deep-merged into {@link Minify.jsOptions}.
|
|
1937
|
+
* It is mainly used together with ReactLynx dual-thread outputs so that
|
|
1938
|
+
* main-thread and background-thread bundles can use different compress rules.
|
|
1939
|
+
*
|
|
1940
|
+
* @example
|
|
1941
|
+
*
|
|
1942
|
+
* ```ts
|
|
1943
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
1944
|
+
*
|
|
1945
|
+
* export default defineConfig({
|
|
1946
|
+
* output: {
|
|
1947
|
+
* minify: {
|
|
1948
|
+
* jsOptions: {
|
|
1949
|
+
* minimizerOptions: {
|
|
1950
|
+
* compress: {
|
|
1951
|
+
* pure_funcs: ['console.log'],
|
|
1952
|
+
* },
|
|
1953
|
+
* },
|
|
1954
|
+
* },
|
|
1955
|
+
* mainThreadOptions: {
|
|
1956
|
+
* minimizerOptions: {
|
|
1957
|
+
* compress: {
|
|
1958
|
+
* pure_funcs: ['NativeModules.call', 'lynx.getJSModule'],
|
|
1959
|
+
* },
|
|
1960
|
+
* },
|
|
1961
|
+
* },
|
|
1962
|
+
* },
|
|
1963
|
+
* },
|
|
1964
|
+
* })
|
|
1965
|
+
* ```
|
|
1966
|
+
*/
|
|
1967
|
+
mainThreadOptions?: Rspack.SwcJsMinimizerRspackPluginOptions | undefined;
|
|
1968
|
+
/**
|
|
1969
|
+
* {@link Minify.backgroundOptions} is used to override
|
|
1970
|
+
* {@link Minify.jsOptions} for background-thread bundles.
|
|
1971
|
+
*
|
|
1972
|
+
* @defaultValue undefined
|
|
1973
|
+
*
|
|
1974
|
+
* @remarks
|
|
1975
|
+
*
|
|
1976
|
+
* This option is deep-merged into {@link Minify.jsOptions}.
|
|
1977
|
+
* It is mainly used together with ReactLynx dual-thread outputs so that
|
|
1978
|
+
* main-thread and background-thread bundles can use different compress rules.
|
|
1979
|
+
*/
|
|
1980
|
+
backgroundOptions?: Rspack.SwcJsMinimizerRspackPluginOptions | undefined;
|
|
1917
1981
|
}
|
|
1918
1982
|
|
|
1919
1983
|
/**
|
|
@@ -1924,6 +1988,8 @@ export declare interface Output {
|
|
|
1924
1988
|
/**
|
|
1925
1989
|
* The {@link Output.assetPrefix} is used to set the URL prefix for static assets.
|
|
1926
1990
|
*
|
|
1991
|
+
* @defaultValue undefined
|
|
1992
|
+
*
|
|
1927
1993
|
* @remarks
|
|
1928
1994
|
*
|
|
1929
1995
|
* The functionality of {@link Output.assetPrefix} is basically the same as the {@link https://www.rspack.dev/config/output#outputpublicpath | output.publicPath}
|
|
@@ -1950,11 +2016,7 @@ export declare interface Output {
|
|
|
1950
2016
|
/**
|
|
1951
2017
|
* The {@link Output.cleanDistPath} option determines whether all files in the output directory (default: `dist`) are removed before the build starts.
|
|
1952
2018
|
*
|
|
1953
|
-
* @
|
|
1954
|
-
*
|
|
1955
|
-
* By default, if the output directory is a subdirectory of the project root path, Rspeedy will automatically clean all files in the build directory.
|
|
1956
|
-
*
|
|
1957
|
-
* When {@link https://rsbuild.dev/config/output/dist-path#root-directory | output.distPath.root} is an external directory or the same as the project root directory, `cleanDistPath` is not enabled by default to prevent accidental deletion of files from other directories.
|
|
2019
|
+
* @defaultValue Automatically enabled when `output.distPath.root` is a subdirectory of the project root; otherwise disabled.
|
|
1958
2020
|
*
|
|
1959
2021
|
* @example
|
|
1960
2022
|
*
|
|
@@ -1985,6 +2047,8 @@ export declare interface Output {
|
|
|
1985
2047
|
/**
|
|
1986
2048
|
* The {@link Output.copy} option is used for copying files to the dist directory.
|
|
1987
2049
|
*
|
|
2050
|
+
* @defaultValue undefined
|
|
2051
|
+
*
|
|
1988
2052
|
* @remarks
|
|
1989
2053
|
*
|
|
1990
2054
|
* For more options, see {@link https://rspack.dev/plugins/rspack/copy-rspack-plugin | Rspack.CopyRspackPlugin}.
|
|
@@ -2027,6 +2091,8 @@ export declare interface Output {
|
|
|
2027
2091
|
/**
|
|
2028
2092
|
* The {@link CssModules} option is used for the customization of CSS Modules configurations.
|
|
2029
2093
|
*
|
|
2094
|
+
* @defaultValue undefined
|
|
2095
|
+
*
|
|
2030
2096
|
* @remarks
|
|
2031
2097
|
*
|
|
2032
2098
|
* The CSS module is enabled for `*.module.css`, `*.module.scss` and `*.module.less`.
|
|
@@ -2066,9 +2132,7 @@ export declare interface Output {
|
|
|
2066
2132
|
/**
|
|
2067
2133
|
* The {@link Output.dataUriLimit} option is used to set the size threshold to inline static assets such as images and fonts.
|
|
2068
2134
|
*
|
|
2069
|
-
* @
|
|
2070
|
-
*
|
|
2071
|
-
* The default value of `dataUriLimit` is 2kB.
|
|
2135
|
+
* @defaultValue 2048
|
|
2072
2136
|
*
|
|
2073
2137
|
* @example
|
|
2074
2138
|
*
|
|
@@ -2129,6 +2193,8 @@ export declare interface Output {
|
|
|
2129
2193
|
/**
|
|
2130
2194
|
* Set the directory of the dist files.
|
|
2131
2195
|
*
|
|
2196
|
+
* @defaultValue Uses Rsbuild's default distPath configuration with `root: 'dist'`.
|
|
2197
|
+
*
|
|
2132
2198
|
* @remarks
|
|
2133
2199
|
*
|
|
2134
2200
|
* More options can be found at {@link https://rsbuild.dev/config/output/dist-path | Rsbuild - distPath}.
|
|
@@ -2152,6 +2218,8 @@ export declare interface Output {
|
|
|
2152
2218
|
/**
|
|
2153
2219
|
* The {@link Filename} determines the name of the JavaScript bundle file to be output. These bundles will be written to the directory specified by output.path.
|
|
2154
2220
|
*
|
|
2221
|
+
* @defaultValue `{ bundle: '[name].[platform].bundle', template: '[name].[platform].bundle' }`
|
|
2222
|
+
*
|
|
2155
2223
|
* @remarks
|
|
2156
2224
|
*
|
|
2157
2225
|
* If a string is provided, it will be used as {@link Filename.bundle}.
|
|
@@ -2171,6 +2239,8 @@ export declare interface Output {
|
|
|
2171
2239
|
/**
|
|
2172
2240
|
* The {@link Output.filenameHash} option controls whether to add a hash value to the filename after the production build.
|
|
2173
2241
|
*
|
|
2242
|
+
* @defaultValue In production web builds, Rsbuild defaults this option to `true`; development builds and non-web outputs omit hashes by default.
|
|
2243
|
+
*
|
|
2174
2244
|
* @remarks
|
|
2175
2245
|
*
|
|
2176
2246
|
* {@link Output.filename} has a higher priority than {@link Output.filenameHash}.
|
|
@@ -2215,9 +2285,9 @@ export declare interface Output {
|
|
|
2215
2285
|
/**
|
|
2216
2286
|
* The {@link Output.inlineScripts} option controls whether to inline scripts into Lynx bundle (`.lynx.bundle`).
|
|
2217
2287
|
*
|
|
2218
|
-
* @
|
|
2288
|
+
* @defaultValue Rspeedy defaults this to `true` and only switches it to `false` when the user explicitly sets `performance.chunkSplit.strategy` to a value other than `'all-in-one'`.
|
|
2219
2289
|
*
|
|
2220
|
-
*
|
|
2290
|
+
* @remarks
|
|
2221
2291
|
*
|
|
2222
2292
|
* This is different with {@link https://rsbuild.dev/config/output/inline-scripts | output.inlineScripts } since we normally want to inline scripts in Lynx bundle (`.lynx.bundle`).
|
|
2223
2293
|
*
|
|
@@ -2244,9 +2314,9 @@ export declare interface Output {
|
|
|
2244
2314
|
/**
|
|
2245
2315
|
* The {@link Output.legalComments} controls how to handle the legal comment.
|
|
2246
2316
|
*
|
|
2247
|
-
* @
|
|
2317
|
+
* @defaultValue `'none'`
|
|
2248
2318
|
*
|
|
2249
|
-
*
|
|
2319
|
+
* @remarks
|
|
2250
2320
|
*
|
|
2251
2321
|
* This is different with Rsbuild since we normally do not want a `.LEGAL.txt` file in Lynx outputs.
|
|
2252
2322
|
*
|
|
@@ -2262,6 +2332,8 @@ export declare interface Output {
|
|
|
2262
2332
|
/**
|
|
2263
2333
|
* The {@link Minify} configures whether to enable code minification in the production build, or to configure minimizer options.
|
|
2264
2334
|
*
|
|
2335
|
+
* @defaultValue `true` in production builds and `false` otherwise
|
|
2336
|
+
*
|
|
2265
2337
|
* @example
|
|
2266
2338
|
*
|
|
2267
2339
|
* Disable minification.
|
|
@@ -2277,6 +2349,8 @@ export declare interface Output {
|
|
|
2277
2349
|
minify?: Minify | boolean | undefined;
|
|
2278
2350
|
/**
|
|
2279
2351
|
* The {@link SourceMap} configures whether and how to generate source-map for outputs.
|
|
2352
|
+
*
|
|
2353
|
+
* @defaultValue When this option is unset, JavaScript source maps use `'cheap-module-source-map'` in development and are otherwise disabled; CSS source maps are disabled.
|
|
2280
2354
|
*/
|
|
2281
2355
|
sourceMap?: boolean | SourceMap | undefined;
|
|
2282
2356
|
}
|
|
@@ -2290,6 +2364,8 @@ export declare interface Performance {
|
|
|
2290
2364
|
/**
|
|
2291
2365
|
* Enable or configure persistent build cache.
|
|
2292
2366
|
*
|
|
2367
|
+
* @defaultValue false
|
|
2368
|
+
*
|
|
2293
2369
|
* @beta This feature is experimental and may be changed in the future.
|
|
2294
2370
|
*
|
|
2295
2371
|
* @example
|
|
@@ -2326,14 +2402,14 @@ export declare interface Performance {
|
|
|
2326
2402
|
buildCache?: BuildCache | boolean | undefined;
|
|
2327
2403
|
/**
|
|
2328
2404
|
* {@link Performance.chunkSplit} is used to configure the chunk splitting strategy.
|
|
2405
|
+
*
|
|
2406
|
+
* @defaultValue For web builds, Rsbuild currently uses `{ strategy: 'split-by-experience' }` when this option is unset.
|
|
2329
2407
|
*/
|
|
2330
2408
|
chunkSplit?: ChunkSplit | ChunkSplitBySize | ChunkSplitCustom | undefined;
|
|
2331
2409
|
/**
|
|
2332
2410
|
* Whether capture timing information in the build time and the runtime, the same as the {@link https://rspack.dev/config/other-options#profile | profile} config of Rspack.
|
|
2333
2411
|
*
|
|
2334
|
-
* @
|
|
2335
|
-
*
|
|
2336
|
-
* This option would be `true` when `DEBUG` environment variable contains `rspeedy`.
|
|
2412
|
+
* @defaultValue Rspeedy sets this to `true` when `DEBUG` contains `rspeedy`; otherwise it leaves the option unset.
|
|
2337
2413
|
*
|
|
2338
2414
|
* @example
|
|
2339
2415
|
*
|
|
@@ -2357,6 +2433,8 @@ export declare interface Performance {
|
|
|
2357
2433
|
/**
|
|
2358
2434
|
* Whether to remove `console.[methodName]` in production build.
|
|
2359
2435
|
*
|
|
2436
|
+
* @defaultValue false
|
|
2437
|
+
*
|
|
2360
2438
|
* @example
|
|
2361
2439
|
*
|
|
2362
2440
|
* - Remove all `console` methods
|
|
@@ -2389,6 +2467,8 @@ export declare interface Performance {
|
|
|
2389
2467
|
/**
|
|
2390
2468
|
* Whether to print the file sizes after production build.
|
|
2391
2469
|
*
|
|
2470
|
+
* @defaultValue true
|
|
2471
|
+
*
|
|
2392
2472
|
* {@link Performance.printFileSize}
|
|
2393
2473
|
*
|
|
2394
2474
|
* See {@link https://rsbuild.dev/config/performance/print-file-size | Rsbuild - performance.printFileSize} for details.
|
|
@@ -2511,6 +2591,8 @@ export declare interface Resolve {
|
|
|
2511
2591
|
/**
|
|
2512
2592
|
* Create aliases to `import` or `require` certain modules more easily.
|
|
2513
2593
|
*
|
|
2594
|
+
* @defaultValue undefined
|
|
2595
|
+
*
|
|
2514
2596
|
* @example
|
|
2515
2597
|
*
|
|
2516
2598
|
* A trailing `$` can also be added to the given object's keys to signify an exact match:
|
|
@@ -2591,6 +2673,9 @@ export declare interface Resolve {
|
|
|
2591
2673
|
/**
|
|
2592
2674
|
* Set the strategy for path alias resolution, to control the priority relationship
|
|
2593
2675
|
* between the `paths` option in `tsconfig.json` and the `resolve.alias` option of Rsbuild.
|
|
2676
|
+
*
|
|
2677
|
+
* @defaultValue `'prefer-tsconfig'`
|
|
2678
|
+
*
|
|
2594
2679
|
* - `prefer-tsconfig` (default): The `paths` option in `tsconfig.json` will take precedence over the
|
|
2595
2680
|
* `resolve.alias` option of Rsbuild.
|
|
2596
2681
|
* - `prefer-alias`: The `resolve.alias` option of Rsbuild will take precedence over the
|
|
@@ -2615,6 +2700,8 @@ export declare interface Resolve {
|
|
|
2615
2700
|
/**
|
|
2616
2701
|
* Force to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size.
|
|
2617
2702
|
*
|
|
2703
|
+
* @defaultValue undefined
|
|
2704
|
+
*
|
|
2618
2705
|
* @remarks
|
|
2619
2706
|
*
|
|
2620
2707
|
* {@link Resolve.dedupe} is implemented based on {@link Resolve.alias}, it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias.
|
|
@@ -2639,7 +2726,7 @@ export declare interface Resolve {
|
|
|
2639
2726
|
/**
|
|
2640
2727
|
* Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
|
|
2641
2728
|
*
|
|
2642
|
-
*
|
|
2729
|
+
* @defaultValue `['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']`
|
|
2643
2730
|
*
|
|
2644
2731
|
* For example, if importing './index', Rsbuild will try to resolve using the following order:
|
|
2645
2732
|
*
|
|
@@ -2707,8 +2794,10 @@ export declare interface Server {
|
|
|
2707
2794
|
/**
|
|
2708
2795
|
* Configure the base path of the server.
|
|
2709
2796
|
*
|
|
2797
|
+
* @defaultValue `'/'`
|
|
2798
|
+
*
|
|
2710
2799
|
* @remarks
|
|
2711
|
-
*
|
|
2800
|
+
* Users can access lynx bundle through `http://<host>:<port>/main.lynx.bundle` by default.
|
|
2712
2801
|
*
|
|
2713
2802
|
* If you want to access lynx bundle through `http://<host>:<port>/foo/main.lynx.bundle`, you can change `server.base` to `/foo`
|
|
2714
2803
|
*
|
|
@@ -2729,7 +2818,7 @@ export declare interface Server {
|
|
|
2729
2818
|
/**
|
|
2730
2819
|
* Configure whether to enable {@link https://developer.mozilla.org/en-US/docs/Glossary/gzip_compression | gzip compression } for static assets served by the dev server or preview server.
|
|
2731
2820
|
*
|
|
2732
|
-
*
|
|
2821
|
+
* @defaultValue true
|
|
2733
2822
|
*
|
|
2734
2823
|
* See {@link https://rsbuild.rs/config/server/compress | Rsbuild - server.compress } for details.
|
|
2735
2824
|
*
|
|
@@ -2782,6 +2871,8 @@ export declare interface Server {
|
|
|
2782
2871
|
/**
|
|
2783
2872
|
* Configure CORS for the dev server or preview server.
|
|
2784
2873
|
*
|
|
2874
|
+
* @defaultValue Uses Rsbuild's default CORS options.
|
|
2875
|
+
*
|
|
2785
2876
|
* - Set to an object to enable CORS with the specified options.
|
|
2786
2877
|
*
|
|
2787
2878
|
* - Set to `true` to enable CORS with the default options (allows all origins, not recommended).
|
|
@@ -2806,6 +2897,8 @@ export declare interface Server {
|
|
|
2806
2897
|
/**
|
|
2807
2898
|
* Adds headers to all responses.
|
|
2808
2899
|
*
|
|
2900
|
+
* @defaultValue undefined
|
|
2901
|
+
*
|
|
2809
2902
|
* @example
|
|
2810
2903
|
*
|
|
2811
2904
|
* ```js
|
|
@@ -2823,8 +2916,10 @@ export declare interface Server {
|
|
|
2823
2916
|
/**
|
|
2824
2917
|
* Specify the host that the Rspeedy Server listens to.
|
|
2825
2918
|
*
|
|
2919
|
+
* @defaultValue undefined
|
|
2920
|
+
*
|
|
2826
2921
|
* @remarks
|
|
2827
|
-
*
|
|
2922
|
+
* During `rspeedy dev`, if `server.host` is unset, the dev plugin resolves dev-server-related URLs and client host settings with a detected local IPv4 address, such as `192.168.1.50`. If you have multiple network interfaces, set `server.host` explicitly to choose the desired address.
|
|
2828
2923
|
*
|
|
2829
2924
|
* @example
|
|
2830
2925
|
*
|
|
@@ -2843,8 +2938,10 @@ export declare interface Server {
|
|
|
2843
2938
|
/**
|
|
2844
2939
|
* Specify the port that the Rspeedy Server listens to.
|
|
2845
2940
|
*
|
|
2941
|
+
* @defaultValue Rsbuild defaults this option to `3000`.
|
|
2942
|
+
*
|
|
2846
2943
|
* @remarks
|
|
2847
|
-
* By default, the server
|
|
2944
|
+
* By default, the server automatically increments the port number when the configured port is occupied.
|
|
2848
2945
|
*
|
|
2849
2946
|
* @example
|
|
2850
2947
|
*
|
|
@@ -2863,6 +2960,8 @@ export declare interface Server {
|
|
|
2863
2960
|
/**
|
|
2864
2961
|
* Configure proxy rules for the dev server or preview server to proxy requests to the specified service.
|
|
2865
2962
|
*
|
|
2963
|
+
* @defaultValue undefined
|
|
2964
|
+
*
|
|
2866
2965
|
* @example
|
|
2867
2966
|
*
|
|
2868
2967
|
* ```js
|
|
@@ -2881,7 +2980,9 @@ export declare interface Server {
|
|
|
2881
2980
|
/**
|
|
2882
2981
|
* When a port is occupied, Rspeedy will automatically increment the port number until an available port is found.
|
|
2883
2982
|
*
|
|
2884
|
-
*
|
|
2983
|
+
* @defaultValue false
|
|
2984
|
+
*
|
|
2985
|
+
* By default, strict port mode is disabled. Set strictPort to true and Rspeedy will throw an exception when the port is occupied.
|
|
2885
2986
|
*/
|
|
2886
2987
|
strictPort?: boolean | undefined;
|
|
2887
2988
|
}
|
|
@@ -2896,10 +2997,14 @@ export declare interface Source {
|
|
|
2896
2997
|
* {@inheritdoc Resolve.alias}
|
|
2897
2998
|
*
|
|
2898
2999
|
* @deprecated - Use {@link Resolve.alias} instead.
|
|
3000
|
+
*
|
|
3001
|
+
* @defaultValue undefined
|
|
2899
3002
|
*/
|
|
2900
3003
|
alias?: Record<string, string | false | string[]> | undefined;
|
|
2901
3004
|
/**
|
|
2902
|
-
* Include additional files that should be treated as static assets.
|
|
3005
|
+
* Include additional files that should be treated as static assets.
|
|
3006
|
+
*
|
|
3007
|
+
* @defaultValue undefined
|
|
2903
3008
|
*
|
|
2904
3009
|
* @remarks
|
|
2905
3010
|
*
|
|
@@ -2926,6 +3031,8 @@ export declare interface Source {
|
|
|
2926
3031
|
/**
|
|
2927
3032
|
* Used to configure the decorators syntax.
|
|
2928
3033
|
*
|
|
3034
|
+
* @defaultValue undefined
|
|
3035
|
+
*
|
|
2929
3036
|
* @remarks
|
|
2930
3037
|
*
|
|
2931
3038
|
* See {@link Decorators.version} for more information.
|
|
@@ -2934,6 +3041,8 @@ export declare interface Source {
|
|
|
2934
3041
|
/**
|
|
2935
3042
|
* The `define` options is used to define some values or expressions at compile time.
|
|
2936
3043
|
*
|
|
3044
|
+
* @defaultValue undefined
|
|
3045
|
+
*
|
|
2937
3046
|
* @example
|
|
2938
3047
|
*
|
|
2939
3048
|
* Using `define` for environment variables.
|
|
@@ -3026,10 +3135,6 @@ export declare interface Source {
|
|
|
3026
3135
|
/**
|
|
3027
3136
|
* The {@link Entry} option is used to set the entry module.
|
|
3028
3137
|
*
|
|
3029
|
-
* @remarks
|
|
3030
|
-
*
|
|
3031
|
-
* If no value is provided, the default value `'./src/index.js'` will be used.
|
|
3032
|
-
*
|
|
3033
3138
|
* @defaultValue `'./src/index.js'`
|
|
3034
3139
|
*
|
|
3035
3140
|
* @example
|
|
@@ -3096,6 +3201,8 @@ export declare interface Source {
|
|
|
3096
3201
|
/**
|
|
3097
3202
|
* The `source.exclude` is used to specify JavaScript files that should be excluded from compilation.
|
|
3098
3203
|
*
|
|
3204
|
+
* @defaultValue undefined
|
|
3205
|
+
*
|
|
3099
3206
|
* @remarks
|
|
3100
3207
|
*
|
|
3101
3208
|
* By default, Rsbuild compiles JavaScript files in the current directory and TypeScript/JSX files
|
|
@@ -3157,6 +3264,8 @@ export declare interface Source {
|
|
|
3157
3264
|
/**
|
|
3158
3265
|
* The `source.include` is used to specify additional JavaScript files that need to be compiled.
|
|
3159
3266
|
*
|
|
3267
|
+
* @defaultValue When unset, Rsbuild compiles JavaScript files in the current directory and TypeScript or JSX files in all directories, while excluding JavaScript files under `node_modules`.
|
|
3268
|
+
*
|
|
3160
3269
|
* @remarks
|
|
3161
3270
|
*
|
|
3162
3271
|
* To avoid redundant compilation, by default, Rsbuild only compiles JavaScript
|
|
@@ -3233,6 +3342,8 @@ export declare interface Source {
|
|
|
3233
3342
|
* Add a script before the entry file of each page. This script will be executed before the page code.
|
|
3234
3343
|
* It can be used to execute global logics, such as injecting polyfills, setting global styles, etc.
|
|
3235
3344
|
*
|
|
3345
|
+
* @defaultValue undefined
|
|
3346
|
+
*
|
|
3236
3347
|
* @remarks
|
|
3237
3348
|
*
|
|
3238
3349
|
* See {@link https://rsbuild.dev/config/source/pre-entry | source.preEntry} for more details.
|
|
@@ -3254,6 +3365,8 @@ export declare interface Source {
|
|
|
3254
3365
|
/**
|
|
3255
3366
|
* The {@link TransformImport} option transforms the import paths to enable modular imports from subpaths of third-party packages, similar to the functionality provided by {@link https://npmjs.com/package/babel-plugin-import | babel-plugin-import}.
|
|
3256
3367
|
*
|
|
3368
|
+
* @defaultValue undefined
|
|
3369
|
+
*
|
|
3257
3370
|
* @example
|
|
3258
3371
|
*
|
|
3259
3372
|
* When using the TUX component library, you can import components on demand with the following config:
|
|
@@ -3287,7 +3400,9 @@ export declare interface Source {
|
|
|
3287
3400
|
*/
|
|
3288
3401
|
transformImport?: TransformImport[] | undefined;
|
|
3289
3402
|
/**
|
|
3290
|
-
* Configure a custom `tsconfig.json` file path to use, can be a relative or absolute path.
|
|
3403
|
+
* Configure a custom `tsconfig.json` file path to use, can be a relative or absolute path.
|
|
3404
|
+
*
|
|
3405
|
+
* @defaultValue `'./tsconfig.json'`
|
|
3291
3406
|
*
|
|
3292
3407
|
* @remarks
|
|
3293
3408
|
*
|
|
@@ -3322,9 +3437,9 @@ export declare interface SourceMap {
|
|
|
3322
3437
|
/**
|
|
3323
3438
|
* How the source map should be generated. Setting it to `false` will disable the source map.
|
|
3324
3439
|
*
|
|
3325
|
-
* @
|
|
3440
|
+
* @defaultValue When `output.sourceMap` is an object and `js` is unset, it defaults to `'cheap-module-source-map'` in development and `false` in production.
|
|
3326
3441
|
*
|
|
3327
|
-
*
|
|
3442
|
+
* @remarks
|
|
3328
3443
|
*
|
|
3329
3444
|
* See {@link https://rspack.dev/config/devtool | Rspack - Devtool} for details.
|
|
3330
3445
|
*
|
|
@@ -3390,6 +3505,8 @@ export declare interface Tools {
|
|
|
3390
3505
|
/**
|
|
3391
3506
|
* The {@link Tools.bundlerChain} changes the options of {@link https://www.rspack.dev | Rspack} using {@link https://github.com/rspack-contrib/rspack-chain | rspack-chain}.
|
|
3392
3507
|
*
|
|
3508
|
+
* @defaultValue undefined
|
|
3509
|
+
*
|
|
3393
3510
|
* @example
|
|
3394
3511
|
*
|
|
3395
3512
|
* ```js
|
|
@@ -3410,6 +3527,8 @@ export declare interface Tools {
|
|
|
3410
3527
|
/**
|
|
3411
3528
|
* The {@link CssLoader} controls the options of {@link https://github.com/webpack-contrib/css-loader | css-loader}.
|
|
3412
3529
|
*
|
|
3530
|
+
* @defaultValue Uses defaults derived from `output.cssModules` and `output.sourceMap`, with `importLoaders` set to `1` for CSS files and `2` for Sass/Less files.
|
|
3531
|
+
*
|
|
3413
3532
|
* @remarks
|
|
3414
3533
|
*
|
|
3415
3534
|
* The default option is as follow:
|
|
@@ -3431,11 +3550,18 @@ export declare interface Tools {
|
|
|
3431
3550
|
cssLoader?: CssLoader | undefined;
|
|
3432
3551
|
/**
|
|
3433
3552
|
* The {@link CssExtract} controls the options of {@link https://www.rspack.dev/plugins/rspack/css-extract-rspack-plugin | CssExtractRspackPlugin}
|
|
3553
|
+
*
|
|
3554
|
+
* @defaultValue undefined
|
|
3434
3555
|
*/
|
|
3435
3556
|
cssExtract?: CssExtract | undefined;
|
|
3436
3557
|
/**
|
|
3437
3558
|
* The {@link Tools.rsdoctor} controls the options of {@link https://rsdoctor.dev/ | Rsdoctor}.
|
|
3438
3559
|
*
|
|
3560
|
+
* @defaultValue undefined
|
|
3561
|
+
*
|
|
3562
|
+
* @remarks
|
|
3563
|
+
* Setting `RSDOCTOR=true` enables Rsdoctor. When it is enabled, Rspeedy merges additional plugin defaults during config normalization.
|
|
3564
|
+
*
|
|
3439
3565
|
* @example
|
|
3440
3566
|
*
|
|
3441
3567
|
* - Use the built-in Rsdoctor.
|
|
@@ -3458,6 +3584,8 @@ export declare interface Tools {
|
|
|
3458
3584
|
/**
|
|
3459
3585
|
* The {@link Tools.rspack} controls the options of {@link https://www.rspack.dev/ | Rspack}.
|
|
3460
3586
|
*
|
|
3587
|
+
* @defaultValue undefined
|
|
3588
|
+
*
|
|
3461
3589
|
* @example
|
|
3462
3590
|
*
|
|
3463
3591
|
* - Use object config
|
|
@@ -3543,6 +3671,8 @@ export declare interface Tools {
|
|
|
3543
3671
|
rspack?: ToolsConfig['rspack'] | undefined;
|
|
3544
3672
|
/**
|
|
3545
3673
|
* The {@link Tools.swc} controls the options of {@link https://rspack.dev/guide/features/builtin-swc-loader | builtin:swc-loader}.
|
|
3674
|
+
*
|
|
3675
|
+
* @defaultValue undefined
|
|
3546
3676
|
*/
|
|
3547
3677
|
swc?: ToolsConfig['swc'] | undefined;
|
|
3548
3678
|
}
|
|
@@ -3556,6 +3686,8 @@ export declare interface TransformImport {
|
|
|
3556
3686
|
/**
|
|
3557
3687
|
* Whether to convert camelCase imports to kebab-case.
|
|
3558
3688
|
*
|
|
3689
|
+
* @defaultValue Rsbuild defaults this option to `true`.
|
|
3690
|
+
*
|
|
3559
3691
|
* @example
|
|
3560
3692
|
*
|
|
3561
3693
|
* - Input:
|
|
@@ -3571,7 +3703,7 @@ export declare interface TransformImport {
|
|
|
3571
3703
|
* import ButtonGroup from 'foo/button-group'
|
|
3572
3704
|
* ```
|
|
3573
3705
|
*
|
|
3574
|
-
* When set to `false
|
|
3706
|
+
* When set to `false`:
|
|
3575
3707
|
* ```js
|
|
3576
3708
|
* import ButtonGroup from 'foo/ButtonGroup'
|
|
3577
3709
|
* ```
|
|
@@ -3580,6 +3712,8 @@ export declare interface TransformImport {
|
|
|
3580
3712
|
/**
|
|
3581
3713
|
* Customize the transformed path.
|
|
3582
3714
|
*
|
|
3715
|
+
* @defaultValue undefined
|
|
3716
|
+
*
|
|
3583
3717
|
* @remarks
|
|
3584
3718
|
*
|
|
3585
3719
|
* You you can specify the format of the transformed path.
|
|
@@ -3609,9 +3743,7 @@ export declare interface TransformImport {
|
|
|
3609
3743
|
/**
|
|
3610
3744
|
* Used to splice the transformed path, the splicing rule is `${libraryName}/${libraryDirectory}/${member}`, where member is the imported member.
|
|
3611
3745
|
*
|
|
3612
|
-
* @
|
|
3613
|
-
*
|
|
3614
|
-
* The default value is `'lib'`.
|
|
3746
|
+
* @defaultValue `'lib'`
|
|
3615
3747
|
*
|
|
3616
3748
|
* @example
|
|
3617
3749
|
*
|
|
@@ -3631,6 +3763,8 @@ export declare interface TransformImport {
|
|
|
3631
3763
|
/**
|
|
3632
3764
|
* Whether to convert import statements to default imports.
|
|
3633
3765
|
*
|
|
3766
|
+
* @defaultValue Rsbuild defaults this option to `true`.
|
|
3767
|
+
*
|
|
3634
3768
|
* @example
|
|
3635
3769
|
*
|
|
3636
3770
|
* - Input:
|
|
@@ -3646,7 +3780,7 @@ export declare interface TransformImport {
|
|
|
3646
3780
|
* import Button from 'foo/button'
|
|
3647
3781
|
* ```
|
|
3648
3782
|
*
|
|
3649
|
-
* When set to `false
|
|
3783
|
+
* When set to `false`:
|
|
3650
3784
|
* ```js
|
|
3651
3785
|
* import { Button } from 'foo/button'
|
|
3652
3786
|
* ```
|