/
WebpackOptions.d.ts
3462 lines (3460 loc) · 98.4 KB
/
WebpackOptions.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
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
391
392
393
394
395
396
397
398
399
400
401
402
403
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
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
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
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
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
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
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
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
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
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
/**
* Set the value of `require.amd` and `define.amd`. Or disable AMD support.
*/
export type Amd =
| false
| {
[k: string]: any;
};
/**
* Report the first error as a hard error instead of tolerating it.
*/
export type Bail = boolean;
/**
* Cache generated modules and chunks to improve performance for multiple incremental builds.
*/
export type CacheOptions = true | CacheOptionsNormalized;
/**
* Cache generated modules and chunks to improve performance for multiple incremental builds.
*/
export type CacheOptionsNormalized =
| false
| MemoryCacheOptions
| FileCacheOptions;
/**
* The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
*/
export type Context = string;
/**
* References to other configurations to depend on.
*/
export type Dependencies = string[];
/**
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
export type DevTool = (false | "eval") | string;
/**
* The entry point(s) of the compilation.
*/
export type Entry = EntryDynamic | EntryStatic;
/**
* A Function returning an entry object, an entry string, an entry array or a promise to these things.
*/
export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
/**
* A static entry description.
*/
export type EntryStatic = EntryObject | EntryUnnamed;
/**
* Module(s) that are loaded upon startup.
*/
export type EntryItem = string[] | string;
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
export type ChunkLoading = false | ChunkLoadingType;
/**
* The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
export type ChunkLoadingType =
| ("jsonp" | "import-scripts" | "require" | "async-node" | "import")
| string;
/**
* Specifies the filename of the output file on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
*/
export type EntryFilename = FilenameTemplate;
/**
* Specifies the filename template of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
*/
export type FilenameTemplate =
| string
| ((
pathData: import("../lib/Compilation").PathData,
assetInfo?: import("../lib/Compilation").AssetInfo
) => string);
/**
* Specifies the layer in which modules of this entrypoint are placed.
*/
export type Layer = null | string;
/**
* Add a comment in the UMD wrapper.
*/
export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
/**
* Specify which export should be exposed as library.
*/
export type LibraryExport = string[] | string;
/**
* The name of the library (some types allow unnamed libraries too).
*/
export type LibraryName = string[] | string | LibraryCustomUmdObject;
/**
* Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
export type LibraryType =
| (
| "var"
| "module"
| "assign"
| "assign-properties"
| "this"
| "window"
| "self"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "amd"
| "amd-require"
| "umd"
| "umd2"
| "jsonp"
| "system"
)
| string;
/**
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
*/
export type UmdNamedDefine = boolean;
/**
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
*/
export type PublicPath = "auto" | RawPublicPath;
/**
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
*/
export type RawPublicPath =
| string
| ((
pathData: import("../lib/Compilation").PathData,
assetInfo?: import("../lib/Compilation").AssetInfo
) => string);
/**
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
*/
export type EntryRuntime = false | string;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
export type WasmLoading = false | WasmLoadingType;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
export type WasmLoadingType =
| ("fetch-streaming" | "fetch" | "async-node")
| string;
/**
* An entry point without name.
*/
export type EntryUnnamed = EntryItem;
/**
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
export type Experiments = ExperimentsCommon & ExperimentsExtra;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
export type Externals = ExternalItem[] | ExternalItem;
/**
* Specify dependency that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
export type ExternalItem =
| RegExp
| string
| (ExternalItemObjectKnown & ExternalItemObjectUnknown)
| (
| ((
data: ExternalItemFunctionData,
callback: (err?: Error, result?: ExternalItemValue) => void
) => void)
| ((data: ExternalItemFunctionData) => Promise<ExternalItemValue>)
);
/**
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
*/
export type ExternalsType =
| "var"
| "module"
| "assign"
| "this"
| "window"
| "self"
| "global"
| "commonjs"
| "commonjs2"
| "commonjs-module"
| "amd"
| "amd-require"
| "umd"
| "umd2"
| "jsonp"
| "system"
| "promise"
| "import"
| "script"
| "node-commonjs";
/**
* Ignore specific warnings.
*/
export type IgnoreWarnings = (
| RegExp
| {
/**
* A RegExp to select the origin file for the warning.
*/
file?: RegExp;
/**
* A RegExp to select the warning message.
*/
message?: RegExp;
/**
* A RegExp to select the origin module for the warning.
*/
module?: RegExp;
}
| ((
warning: import("../lib/WebpackError"),
compilation: import("../lib/Compilation")
) => boolean)
)[];
/**
* Filtering values.
*/
export type FilterTypes = FilterItemTypes[] | FilterItemTypes;
/**
* Filtering value, regexp or function.
*/
export type FilterItemTypes = RegExp | string | ((value: string) => boolean);
/**
* Enable production optimizations or development hints.
*/
export type Mode = "development" | "production" | "none";
/**
* One or multiple rule conditions.
*/
export type RuleSetConditionOrConditions = RuleSetCondition | RuleSetConditions;
/**
* A condition matcher.
*/
export type RuleSetCondition =
| RegExp
| string
| ((value: string) => boolean)
| RuleSetLogicalConditions
| RuleSetConditions;
/**
* A list of rule conditions.
*/
export type RuleSetConditions = RuleSetCondition[];
/**
* One or multiple rule conditions matching an absolute path.
*/
export type RuleSetConditionOrConditionsAbsolute =
| RuleSetConditionAbsolute
| RuleSetConditionsAbsolute;
/**
* A condition matcher matching an absolute path.
*/
export type RuleSetConditionAbsolute =
| RegExp
| string
| ((value: string) => boolean)
| RuleSetLogicalConditionsAbsolute
| RuleSetConditionsAbsolute;
/**
* A list of rule conditions matching an absolute path.
*/
export type RuleSetConditionsAbsolute = RuleSetConditionAbsolute[];
/**
* A loader request.
*/
export type RuleSetLoader = string;
/**
* Options passed to a loader.
*/
export type RuleSetLoaderOptions =
| string
| {
[k: string]: any;
};
/**
* Redirect module requests.
*/
export type ResolveAlias =
| {
/**
* New request.
*/
alias: string[] | false | string;
/**
* Request to be redirected.
*/
name: string;
/**
* Redirect only exact matching request.
*/
onlyModule?: boolean;
}[]
| {
/**
* New request.
*/
[k: string]: string[] | false | string;
};
/**
* A list of descriptions of loaders applied.
*/
export type RuleSetUse =
| RuleSetUseItem[]
| ((data: {
resource: string;
realResource: string;
resourceQuery: string;
issuer: string;
compiler: string;
}) => RuleSetUseItem[])
| RuleSetUseItem;
/**
* A description of an applied loader.
*/
export type RuleSetUseItem =
| {
/**
* Unique loader options identifier.
*/
ident?: string;
/**
* Loader name.
*/
loader?: RuleSetLoader;
/**
* Loader options.
*/
options?: RuleSetLoaderOptions;
}
| ((data: object) => RuleSetUseItem | RuleSetUseItem[])
| RuleSetLoader;
/**
* A list of rules.
*/
export type RuleSetRules = ("..." | RuleSetRule)[];
/**
* Specify options for each generator.
*/
export type GeneratorOptionsByModuleType = GeneratorOptionsByModuleTypeKnown &
GeneratorOptionsByModuleTypeUnknown;
/**
* Don't parse files matching. It's matched against the full resolved request.
*/
export type NoParse =
| (RegExp | string | Function)[]
| RegExp
| string
| Function;
/**
* Specify options for each parser.
*/
export type ParserOptionsByModuleType = ParserOptionsByModuleTypeKnown &
ParserOptionsByModuleTypeUnknown;
/**
* Name of the configuration. Used when loading multiple configurations.
*/
export type Name = string;
/**
* Include polyfills or mocks for various node stuff.
*/
export type Node = false | NodeOptions;
/**
* Function acting as plugin.
*/
export type WebpackPluginFunction = (
this: import("../lib/Compiler"),
compiler: import("../lib/Compiler")
) => void;
/**
* Create an additional chunk which contains only the webpack runtime and chunk hash maps.
*/
export type OptimizationRuntimeChunk =
| ("single" | "multiple")
| boolean
| {
/**
* The name or name factory for the runtime chunks.
*/
name?: string | Function;
};
/**
* Size description for limits.
*/
export type OptimizationSplitChunksSizes =
| number
| {
/**
* Size of the part of the chunk with the type of the key.
*/
[k: string]: number;
};
/**
* The filename of asset modules as relative path inside the 'output.path' directory.
*/
export type AssetModuleFilename =
| string
| ((
pathData: import("../lib/Compilation").PathData,
assetInfo?: import("../lib/Compilation").AssetInfo
) => string);
/**
* Add charset attribute for script tag.
*/
export type Charset = boolean;
/**
* Specifies the filename template of output files of non-initial chunks on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
*/
export type ChunkFilename = FilenameTemplate;
/**
* The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
*/
export type ChunkFormat =
| ("array-push" | "commonjs" | "module" | false)
| string;
/**
* Number of milliseconds before chunk request expires.
*/
export type ChunkLoadTimeout = number;
/**
* The global variable used by webpack for loading of chunks.
*/
export type ChunkLoadingGlobal = string;
/**
* Clean the output directory before emit.
*/
export type Clean = boolean | CleanOptions;
/**
* Check if to be emitted file already exists and have the same content before writing to output filesystem.
*/
export type CompareBeforeEmit = boolean;
/**
* This option enables cross-origin loading of chunks.
*/
export type CrossOriginLoading = false | "anonymous" | "use-credentials";
/**
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
*/
export type DevtoolFallbackModuleFilenameTemplate = string | Function;
/**
* Filename template string of function for the sources array in a generated SourceMap.
*/
export type DevtoolModuleFilenameTemplate = string | Function;
/**
* Module namespace to use when interpolating filename template string for the sources array in a generated SourceMap. Defaults to `output.library` if not set. It's useful for avoiding runtime collisions in sourcemaps from multiple webpack projects built as libraries.
*/
export type DevtoolNamespace = string;
/**
* List of chunk loading types enabled for use by entry points.
*/
export type EnabledChunkLoadingTypes = ChunkLoadingType[];
/**
* List of library types enabled for use by entry points.
*/
export type EnabledLibraryTypes = LibraryType[];
/**
* List of wasm loading types enabled for use by entry points.
*/
export type EnabledWasmLoadingTypes = WasmLoadingType[];
/**
* Specifies the filename of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
*/
export type Filename = FilenameTemplate;
/**
* An expression which is used to address the global object/scope in runtime code.
*/
export type GlobalObject = string;
/**
* Digest type used for the hash.
*/
export type HashDigest = string;
/**
* Number of chars which are used for the hash.
*/
export type HashDigestLength = number;
/**
* Algorithm used for generation the hash (see node.js crypto package).
*/
export type HashFunction = string | typeof import("../lib/util/Hash");
/**
* Any string which is added to the hash to salt it.
*/
export type HashSalt = string;
/**
* The filename of the Hot Update Chunks. They are inside the output.path directory.
*/
export type HotUpdateChunkFilename = string;
/**
* The global variable used by webpack for loading of hot update chunks.
*/
export type HotUpdateGlobal = string;
/**
* The filename of the Hot Update Main File. It is inside the 'output.path' directory.
*/
export type HotUpdateMainFilename = string;
/**
* Wrap javascript code into IIFE's to avoid leaking into global scope.
*/
export type Iife = boolean;
/**
* The name of the native import() function (can be exchanged for a polyfill).
*/
export type ImportFunctionName = string;
/**
* The name of the native import.meta object (can be exchanged for a polyfill).
*/
export type ImportMetaName = string;
/**
* Make the output files a library, exporting the exports of the entry point.
*/
export type Library = LibraryName | LibraryOptions;
/**
* Output javascript files as module source type.
*/
export type OutputModule = boolean;
/**
* The output directory as **absolute path** (required).
*/
export type Path = string;
/**
* Include comments with information about the modules.
*/
export type Pathinfo = "verbose" | boolean;
/**
* This option enables loading async chunks via a custom script type, such as script type="module".
*/
export type ScriptType = false | "text/javascript" | "module";
/**
* The filename of the SourceMaps for the JavaScript files. They are inside the 'output.path' directory.
*/
export type SourceMapFilename = string;
/**
* Prefixes every line of the source in the bundle with this string.
*/
export type SourcePrefix = string;
/**
* Handles error in module loading correctly at a performance cost. This will handle module error compatible with the EcmaScript Modules spec.
*/
export type StrictModuleErrorHandling = boolean;
/**
* Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.
*/
export type StrictModuleExceptionHandling = boolean;
/**
* A unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals.
*/
export type UniqueName = string;
/**
* The filename of WebAssembly modules as relative path inside the 'output.path' directory.
*/
export type WebassemblyModuleFilename = string;
/**
* The number of parallel processed modules in the compilation.
*/
export type Parallelism = number;
/**
* Configuration for web performance recommendations.
*/
export type Performance = false | PerformanceOptions;
/**
* Add additional plugins to the compiler.
*/
export type Plugins = (WebpackPluginInstance | WebpackPluginFunction)[];
/**
* Capture timing information for each module.
*/
export type Profile = boolean;
/**
* Store compiler state to a json file.
*/
export type RecordsInputPath = false | string;
/**
* Load compiler state from a json file.
*/
export type RecordsOutputPath = false | string;
/**
* Store/Load compiler state from/to a json file. This will result in persistent ids of modules and chunks. An absolute path is expected. `recordsPath` is used for `recordsInputPath` and `recordsOutputPath` if they left undefined.
*/
export type RecordsPath = false | string;
/**
* Options for the resolver.
*/
export type Resolve = ResolveOptions;
/**
* Options for the resolver when resolving loaders.
*/
export type ResolveLoader = ResolveOptions;
/**
* Stats options object or preset name.
*/
export type StatsValue =
| (
| "none"
| "summary"
| "errors-only"
| "errors-warnings"
| "minimal"
| "normal"
| "detailed"
| "verbose"
)
| boolean
| StatsOptions;
/**
* Filtering modules.
*/
export type ModuleFilterTypes = ModuleFilterItemTypes[] | ModuleFilterItemTypes;
/**
* Filtering value, regexp or function.
*/
export type ModuleFilterItemTypes =
| RegExp
| string
| ((
name: string,
module: import("../lib/stats/DefaultStatsFactoryPlugin").StatsModule,
type: "module" | "chunk" | "root-of-chunk" | "nested"
) => boolean);
/**
* Filtering modules.
*/
export type AssetFilterTypes = AssetFilterItemTypes[] | AssetFilterItemTypes;
/**
* Filtering value, regexp or function.
*/
export type AssetFilterItemTypes =
| RegExp
| string
| ((
name: string,
asset: import("../lib/stats/DefaultStatsFactoryPlugin").StatsAsset
) => boolean);
/**
* Filtering warnings.
*/
export type WarningFilterTypes =
| WarningFilterItemTypes[]
| WarningFilterItemTypes;
/**
* Filtering value, regexp or function.
*/
export type WarningFilterItemTypes =
| RegExp
| string
| ((
warning: import("../lib/stats/DefaultStatsFactoryPlugin").StatsError,
value: string
) => boolean);
/**
* Environment to build for. An array of environments to build for all of them when possible.
*/
export type Target = string[] | false | string;
/**
* Enter watch mode, which rebuilds on file change.
*/
export type Watch = boolean;
/**
* The options for data url generator.
*/
export type AssetGeneratorDataUrl =
| AssetGeneratorDataUrlOptions
| AssetGeneratorDataUrlFunction;
/**
* Function that executes for module and should return an DataUrl string.
*/
export type AssetGeneratorDataUrlFunction = (
source: string | Buffer,
context: {filename: string; module: import("../lib/Module")}
) => string;
/**
* Generator options for asset modules.
*/
export type AssetGeneratorOptions = AssetInlineGeneratorOptions &
AssetResourceGeneratorOptions;
/**
* Function that executes for module and should return whenever asset should be inlined as DataUrl.
*/
export type AssetParserDataUrlFunction = (
source: string | Buffer,
context: {filename: string; module: import("../lib/Module")}
) => boolean;
/**
* A Function returning a Promise resolving to a normalized entry.
*/
export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
/**
* The entry point(s) of the compilation.
*/
export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
/**
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
export type ExperimentsNormalized = ExperimentsCommon &
ExperimentsNormalizedExtra;
/**
* The dependency used for the external.
*/
export type ExternalItemValue =
| string[]
| boolean
| string
| {
[k: string]: any;
};
/**
* List of allowed URIs for building http resources.
*/
export type HttpUriAllowedUris = HttpUriOptionsAllowedUris;
/**
* List of allowed URIs (resp. the beginning of them).
*/
export type HttpUriOptionsAllowedUris = (
| RegExp
| string
| ((uri: string) => boolean)
)[];
/**
* Ignore specific warnings.
*/
export type IgnoreWarningsNormalized = ((
warning: import("../lib/WebpackError"),
compilation: import("../lib/Compilation")
) => boolean)[];
/**
* Create an additional chunk which contains only the webpack runtime and chunk hash maps.
*/
export type OptimizationRuntimeChunkNormalized =
| false
| {
/**
* The name factory for the runtime chunks.
*/
name?: Function;
};
/**
* A function returning cache groups.
*/
export type OptimizationSplitChunksGetCacheGroups = (
module: import("../lib/Module")
) =>
| OptimizationSplitChunksCacheGroup
| OptimizationSplitChunksCacheGroup[]
| void;
/**
* Options object as provided by the user.
*/
export interface WebpackOptions {
/**
* Set the value of `require.amd` and `define.amd`. Or disable AMD support.
*/
amd?: Amd;
/**
* Report the first error as a hard error instead of tolerating it.
*/
bail?: Bail;
/**
* Cache generated modules and chunks to improve performance for multiple incremental builds.
*/
cache?: CacheOptions;
/**
* The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
*/
context?: Context;
/**
* References to other configurations to depend on.
*/
dependencies?: Dependencies;
/**
* Options for the webpack-dev-server.
*/
devServer?: DevServer;
/**
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
devtool?: DevTool;
/**
* The entry point(s) of the compilation.
*/
entry?: Entry;
/**
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
experiments?: Experiments;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
externals?: Externals;
/**
* Enable presets of externals for specific targets.
*/
externalsPresets?: ExternalsPresets;
/**
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
*/
externalsType?: ExternalsType;
/**
* Ignore specific warnings.
*/
ignoreWarnings?: IgnoreWarnings;
/**
* Options for infrastructure level logging.
*/
infrastructureLogging?: InfrastructureLogging;
/**
* Custom values available in the loader context.
*/
loader?: Loader;
/**
* Enable production optimizations or development hints.
*/
mode?: Mode;
/**
* Options affecting the normal modules (`NormalModuleFactory`).
*/
module?: ModuleOptions;
/**
* Name of the configuration. Used when loading multiple configurations.
*/
name?: Name;
/**
* Include polyfills or mocks for various node stuff.
*/
node?: Node;
/**
* Enables/Disables integrated optimizations.
*/
optimization?: Optimization;
/**
* Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
*/
output?: Output;
/**
* The number of parallel processed modules in the compilation.
*/
parallelism?: Parallelism;
/**
* Configuration for web performance recommendations.
*/
performance?: Performance;
/**
* Add additional plugins to the compiler.
*/
plugins?: Plugins;
/**
* Capture timing information for each module.
*/
profile?: Profile;
/**
* Store compiler state to a json file.
*/
recordsInputPath?: RecordsInputPath;
/**
* Load compiler state from a json file.
*/
recordsOutputPath?: RecordsOutputPath;
/**
* Store/Load compiler state from/to a json file. This will result in persistent ids of modules and chunks. An absolute path is expected. `recordsPath` is used for `recordsInputPath` and `recordsOutputPath` if they left undefined.
*/
recordsPath?: RecordsPath;
/**
* Options for the resolver.
*/
resolve?: Resolve;
/**
* Options for the resolver when resolving loaders.
*/
resolveLoader?: ResolveLoader;
/**
* Options affecting how file system snapshots are created and validated.
*/
snapshot?: SnapshotOptions;
/**
* Stats options object or preset name.
*/
stats?: StatsValue;
/**
* Environment to build for. An array of environments to build for all of them when possible.
*/
target?: Target;
/**
* Enter watch mode, which rebuilds on file change.
*/
watch?: Watch;
/**
* Options for the watcher.
*/
watchOptions?: WatchOptions;
}
/**
* Options object for in-memory caching.
*/
export interface MemoryCacheOptions {
/**
* Additionally cache computation of modules that are unchanged and reference only unchanged modules.
*/
cacheUnaffected?: boolean;
/**
* Number of generations unused cache entries stay in memory cache at minimum (1 = may be removed after unused for a single compilation, ..., Infinity: kept forever).
*/
maxGenerations?: number;
/**
* In memory caching.
*/
type: "memory";
}
/**
* Options object for persistent file-based caching.
*/
export interface FileCacheOptions {
/**
* Allows to collect unused memory allocated during deserialization. This requires copying data into smaller buffers and has a performance cost.
*/
allowCollectingMemory?: boolean;
/**
* Dependencies the build depends on (in multiple categories, default categories: 'defaultWebpack').
*/
buildDependencies?: {
/**
* List of dependencies the build depends on.
*/
[k: string]: string[];
};
/**
* Base directory for the cache (defaults to node_modules/.cache/webpack).
*/
cacheDirectory?: string;
/**
* Locations for the cache (defaults to cacheDirectory / name).
*/
cacheLocation?: string;
/**
* Compression type used for the cache files.
*/
compression?: false | "gzip" | "brotli";
/**
* Algorithm used for generation the hash (see node.js crypto package).
*/
hashAlgorithm?: string;
/**
* Time in ms after which idle period the cache storing should happen.
*/
idleTimeout?: number;
/**
* Time in ms after which idle period the cache storing should happen when larger changes has been detected (cumulative build time > 2 x avg cache store time).
*/
idleTimeoutAfterLargeChanges?: number;
/**
* Time in ms after which idle period the initial cache storing should happen.
*/
idleTimeoutForInitialStore?: number;
/**
* List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable.
*/
immutablePaths?: (RegExp | string)[];
/**
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
*/
managedPaths?: (RegExp | string)[];
/**
* Time for which unused cache entries stay in the filesystem cache at minimum (in milliseconds).
*/
maxAge?: number;
/**
* Number of generations unused cache entries stay in memory cache at minimum (0 = no memory cache used, 1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). Cache entries will be deserialized from disk when removed from memory cache.
*/
maxMemoryGenerations?: number;
/**
* Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory.
*/
memoryCacheUnaffected?: boolean;
/**
* Name for the cache. Different names will lead to different coexisting caches.
*/
name?: string;
/**
* Track and log detailed timing information for individual cache items.
*/
profile?: boolean;
/**
* When to store data to the filesystem. (pack: Store data when compiler is idle in a single file).
*/
store?: "pack";
/**
* Filesystem caching.
*/
type: "filesystem";
/**
* Version of the cache data. Different versions won't allow to reuse the cache and override existing content. Update the version when config changed in a way which doesn't allow to reuse cache. This will invalidate the cache.
*/