WebpackOptions.d.ts 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  1. /**
  2. * This file was automatically generated.
  3. * DO NOT MODIFY BY HAND.
  4. * Run `yarn special-lint-fix` to update
  5. */
  6. /**
  7. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  8. * via the `definition` "Entry".
  9. */
  10. export type Entry = EntryDynamic | EntryStatic;
  11. /**
  12. * A Function returning an entry object, an entry string, an entry array or a promise to these things.
  13. *
  14. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  15. * via the `definition` "EntryDynamic".
  16. */
  17. export type EntryDynamic = (() => EntryStatic | Promise<EntryStatic>);
  18. /**
  19. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  20. * via the `definition` "EntryStatic".
  21. */
  22. export type EntryStatic = EntryObject | EntryItem;
  23. /**
  24. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  25. * via the `definition` "NonEmptyArrayOfUniqueStringValues".
  26. */
  27. export type NonEmptyArrayOfUniqueStringValues = string[];
  28. /**
  29. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  30. * via the `definition` "EntryItem".
  31. */
  32. export type EntryItem = string | NonEmptyArrayOfUniqueStringValues;
  33. /**
  34. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  35. * via the `definition` "Externals".
  36. */
  37. export type Externals =
  38. | ((
  39. context: string,
  40. request: string,
  41. callback: (err?: Error, result?: string) => void
  42. ) => void)
  43. | ExternalItem
  44. | (
  45. | ((
  46. context: string,
  47. request: string,
  48. callback: (err?: Error, result?: string) => void
  49. ) => void)
  50. | ExternalItem)[];
  51. /**
  52. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  53. * via the `definition` "ExternalItem".
  54. */
  55. export type ExternalItem =
  56. | string
  57. | {
  58. /**
  59. * The dependency used for the external
  60. */
  61. [k: string]:
  62. | string
  63. | {
  64. [k: string]: any;
  65. }
  66. | ArrayOfStringValues
  67. | boolean;
  68. }
  69. | RegExp;
  70. /**
  71. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  72. * via the `definition` "ArrayOfStringValues".
  73. */
  74. export type ArrayOfStringValues = string[];
  75. /**
  76. * One or multiple rule conditions
  77. *
  78. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  79. * via the `definition` "RuleSetConditionOrConditions".
  80. */
  81. export type RuleSetConditionOrConditions = RuleSetCondition | RuleSetConditions;
  82. /**
  83. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  84. * via the `definition` "RuleSetCondition".
  85. */
  86. export type RuleSetCondition =
  87. | RegExp
  88. | string
  89. | ((value: string) => boolean)
  90. | RuleSetConditions
  91. | {
  92. /**
  93. * Logical AND
  94. */
  95. and?: RuleSetConditions;
  96. /**
  97. * Exclude all modules matching any of these conditions
  98. */
  99. exclude?: RuleSetConditionOrConditions;
  100. /**
  101. * Exclude all modules matching not any of these conditions
  102. */
  103. include?: RuleSetConditionOrConditions;
  104. /**
  105. * Logical NOT
  106. */
  107. not?: RuleSetConditions;
  108. /**
  109. * Logical OR
  110. */
  111. or?: RuleSetConditions;
  112. /**
  113. * Exclude all modules matching any of these conditions
  114. */
  115. test?: RuleSetConditionOrConditions;
  116. };
  117. /**
  118. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  119. * via the `definition` "RuleSetConditions".
  120. */
  121. export type RuleSetConditions = RuleSetConditionsRecursive;
  122. /**
  123. * One or multiple rule conditions
  124. *
  125. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  126. * via the `definition` "RuleSetConditionOrConditionsAbsolute".
  127. */
  128. export type RuleSetConditionOrConditionsAbsolute =
  129. | RuleSetConditionAbsolute
  130. | RuleSetConditionsAbsolute;
  131. /**
  132. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  133. * via the `definition` "RuleSetConditionAbsolute".
  134. */
  135. export type RuleSetConditionAbsolute =
  136. | RegExp
  137. | string
  138. | ((value: string) => boolean)
  139. | RuleSetConditionsAbsolute
  140. | {
  141. /**
  142. * Logical AND
  143. */
  144. and?: RuleSetConditionsAbsolute;
  145. /**
  146. * Exclude all modules matching any of these conditions
  147. */
  148. exclude?: RuleSetConditionOrConditionsAbsolute;
  149. /**
  150. * Exclude all modules matching not any of these conditions
  151. */
  152. include?: RuleSetConditionOrConditionsAbsolute;
  153. /**
  154. * Logical NOT
  155. */
  156. not?: RuleSetConditionsAbsolute;
  157. /**
  158. * Logical OR
  159. */
  160. or?: RuleSetConditionsAbsolute;
  161. /**
  162. * Exclude all modules matching any of these conditions
  163. */
  164. test?: RuleSetConditionOrConditionsAbsolute;
  165. };
  166. /**
  167. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  168. * via the `definition` "RuleSetConditionsAbsolute".
  169. */
  170. export type RuleSetConditionsAbsolute = RuleSetConditionsAbsoluteRecursive;
  171. /**
  172. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  173. * via the `definition` "RuleSetLoader".
  174. */
  175. export type RuleSetLoader = string;
  176. /**
  177. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  178. * via the `definition` "RuleSetUse".
  179. */
  180. export type RuleSetUse = RuleSetUseItem | Function | RuleSetUseItem[];
  181. /**
  182. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  183. * via the `definition` "RuleSetUseItem".
  184. */
  185. export type RuleSetUseItem =
  186. | RuleSetLoader
  187. | Function
  188. | {
  189. /**
  190. * Unique loader identifier
  191. */
  192. ident?: string;
  193. /**
  194. * Loader name
  195. */
  196. loader?: RuleSetLoader;
  197. /**
  198. * Loader options
  199. */
  200. options?: RuleSetQuery;
  201. /**
  202. * Loader query
  203. */
  204. query?: RuleSetQuery;
  205. };
  206. /**
  207. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  208. * via the `definition` "RuleSetQuery".
  209. */
  210. export type RuleSetQuery =
  211. | {
  212. [k: string]: any;
  213. }
  214. | string;
  215. /**
  216. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  217. * via the `definition` "ArrayOfStringOrStringArrayValues".
  218. */
  219. export type ArrayOfStringOrStringArrayValues = (string | string[])[];
  220. /**
  221. * Function acting as plugin
  222. *
  223. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  224. * via the `definition` "WebpackPluginFunction".
  225. */
  226. export type WebpackPluginFunction = (
  227. this: import("../lib/Compiler"),
  228. compiler: import("../lib/Compiler")
  229. ) => void;
  230. /**
  231. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  232. * via the `definition` "RuleSetRules".
  233. */
  234. export type RuleSetRules = RuleSetRule[];
  235. /**
  236. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  237. * via the `definition` "FilterTypes".
  238. */
  239. export type FilterTypes = FilterItemTypes | FilterItemTypes[];
  240. /**
  241. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  242. * via the `definition` "FilterItemTypes".
  243. */
  244. export type FilterItemTypes = RegExp | string | Function;
  245. export interface WebpackOptions {
  246. /**
  247. * Set the value of `require.amd` and `define.amd`.
  248. */
  249. amd?: {
  250. [k: string]: any;
  251. };
  252. /**
  253. * Report the first error as a hard error instead of tolerating it.
  254. */
  255. bail?: boolean;
  256. /**
  257. * Cache generated modules and chunks to improve performance for multiple incremental builds.
  258. */
  259. cache?:
  260. | boolean
  261. | {
  262. [k: string]: any;
  263. };
  264. /**
  265. * The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
  266. */
  267. context?: string;
  268. /**
  269. * References to other configurations to depend on.
  270. */
  271. dependencies?: string[];
  272. /**
  273. * Options for the webpack-dev-server
  274. */
  275. devServer?: {
  276. [k: string]: any;
  277. };
  278. /**
  279. * A developer tool to enhance debugging.
  280. */
  281. devtool?: string | false;
  282. /**
  283. * The entry point(s) of the compilation.
  284. */
  285. entry?: Entry;
  286. /**
  287. * 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`.
  288. */
  289. externals?: Externals;
  290. /**
  291. * Custom values available in the loader context.
  292. */
  293. loader?: {
  294. [k: string]: any;
  295. };
  296. /**
  297. * Enable production optimizations or development hints.
  298. */
  299. mode?: "development" | "production" | "none";
  300. /**
  301. * Options affecting the normal modules (`NormalModuleFactory`).
  302. */
  303. module?: ModuleOptions;
  304. /**
  305. * Name of the configuration. Used when loading multiple configurations.
  306. */
  307. name?: string;
  308. /**
  309. * Include polyfills or mocks for various node stuff.
  310. */
  311. node?: false | NodeOptions;
  312. /**
  313. * Enables/Disables integrated optimizations
  314. */
  315. optimization?: OptimizationOptions;
  316. /**
  317. * Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
  318. */
  319. output?: OutputOptions;
  320. /**
  321. * The number of parallel processed modules in the compilation.
  322. */
  323. parallelism?: number;
  324. /**
  325. * Configuration for web performance recommendations.
  326. */
  327. performance?: false | PerformanceOptions;
  328. /**
  329. * Add additional plugins to the compiler.
  330. */
  331. plugins?: (WebpackPluginInstance | WebpackPluginFunction)[];
  332. /**
  333. * Capture timing information for each module.
  334. */
  335. profile?: boolean;
  336. /**
  337. * Store compiler state to a json file.
  338. */
  339. recordsInputPath?: string;
  340. /**
  341. * Load compiler state from a json file.
  342. */
  343. recordsOutputPath?: string;
  344. /**
  345. * 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.
  346. */
  347. recordsPath?: string;
  348. /**
  349. * Options for the resolver
  350. */
  351. resolve?: ResolveOptions;
  352. /**
  353. * Options for the resolver when resolving loaders
  354. */
  355. resolveLoader?: ResolveOptions;
  356. /**
  357. * Options for webpack-serve
  358. */
  359. serve?: {
  360. [k: string]: any;
  361. };
  362. /**
  363. * Used by the webpack CLI program to pass stats options.
  364. */
  365. stats?:
  366. | StatsOptions
  367. | boolean
  368. | ("none" | "errors-only" | "minimal" | "normal" | "detailed" | "verbose");
  369. /**
  370. * Environment to build for
  371. */
  372. target?:
  373. | (
  374. | "web"
  375. | "webworker"
  376. | "node"
  377. | "async-node"
  378. | "node-webkit"
  379. | "electron-main"
  380. | "electron-renderer")
  381. | ((compiler: import("../lib/Compiler")) => void);
  382. /**
  383. * Enter watch mode, which rebuilds on file change.
  384. */
  385. watch?: boolean;
  386. /**
  387. * Options for the watcher
  388. */
  389. watchOptions?: {
  390. /**
  391. * Delay the rebuilt after the first change. Value is a time in ms.
  392. */
  393. aggregateTimeout?: number;
  394. /**
  395. * Ignore some files from watching
  396. */
  397. ignored?: {
  398. [k: string]: any;
  399. };
  400. /**
  401. * Enable polling mode for watching
  402. */
  403. poll?: boolean | number;
  404. /**
  405. * Stop watching when stdin stream has ended
  406. */
  407. stdin?: boolean;
  408. };
  409. }
  410. /**
  411. * Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
  412. *
  413. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  414. * via the `definition` "EntryObject".
  415. */
  416. export interface EntryObject {
  417. /**
  418. * An entry point with name
  419. */
  420. [k: string]: string | NonEmptyArrayOfUniqueStringValues;
  421. }
  422. /**
  423. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  424. * via the `definition` "ModuleOptions".
  425. */
  426. export interface ModuleOptions {
  427. /**
  428. * An array of rules applied by default for modules.
  429. */
  430. defaultRules?: RuleSetRules;
  431. /**
  432. * Enable warnings for full dynamic dependencies
  433. */
  434. exprContextCritical?: boolean;
  435. /**
  436. * Enable recursive directory lookup for full dynamic dependencies
  437. */
  438. exprContextRecursive?: boolean;
  439. /**
  440. * Sets the default regular expression for full dynamic dependencies
  441. */
  442. exprContextRegExp?: boolean | RegExp;
  443. /**
  444. * Set the default request for full dynamic dependencies
  445. */
  446. exprContextRequest?: string;
  447. /**
  448. * Don't parse files matching. It's matched against the full resolved request.
  449. */
  450. noParse?: RegExp[] | RegExp | Function | string[] | string;
  451. /**
  452. * An array of rules applied for modules.
  453. */
  454. rules?: RuleSetRules;
  455. /**
  456. * Emit errors instead of warnings when imported names don't exist in imported module
  457. */
  458. strictExportPresence?: boolean;
  459. /**
  460. * Handle the this context correctly according to the spec for namespace objects
  461. */
  462. strictThisContextOnImports?: boolean;
  463. /**
  464. * Enable warnings when using the require function in a not statically analyse-able way
  465. */
  466. unknownContextCritical?: boolean;
  467. /**
  468. * Enable recursive directory lookup when using the require function in a not statically analyse-able way
  469. */
  470. unknownContextRecursive?: boolean;
  471. /**
  472. * Sets the regular expression when using the require function in a not statically analyse-able way
  473. */
  474. unknownContextRegExp?: boolean | RegExp;
  475. /**
  476. * Sets the request when using the require function in a not statically analyse-able way
  477. */
  478. unknownContextRequest?: string;
  479. /**
  480. * Cache the resolving of module requests
  481. */
  482. unsafeCache?: boolean | Function;
  483. /**
  484. * Enable warnings for partial dynamic dependencies
  485. */
  486. wrappedContextCritical?: boolean;
  487. /**
  488. * Enable recursive directory lookup for partial dynamic dependencies
  489. */
  490. wrappedContextRecursive?: boolean;
  491. /**
  492. * Set the inner regular expression for partial dynamic dependencies
  493. */
  494. wrappedContextRegExp?: RegExp;
  495. }
  496. /**
  497. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  498. * via the `definition` "RuleSetRule".
  499. */
  500. export interface RuleSetRule {
  501. /**
  502. * Match the child compiler name
  503. */
  504. compiler?: RuleSetConditionOrConditions;
  505. /**
  506. * Enforce this rule as pre or post step
  507. */
  508. enforce?: "pre" | "post";
  509. /**
  510. * Shortcut for resource.exclude
  511. */
  512. exclude?: RuleSetConditionOrConditionsAbsolute;
  513. /**
  514. * Shortcut for resource.include
  515. */
  516. include?: RuleSetConditionOrConditionsAbsolute;
  517. /**
  518. * Match the issuer of the module (The module pointing to this module)
  519. */
  520. issuer?: RuleSetConditionOrConditionsAbsolute;
  521. /**
  522. * Shortcut for use.loader
  523. */
  524. loader?: RuleSetLoader | RuleSetUse;
  525. /**
  526. * Shortcut for use.loader
  527. */
  528. loaders?: RuleSetUse;
  529. /**
  530. * Only execute the first matching rule in this array
  531. */
  532. oneOf?: RuleSetRules;
  533. /**
  534. * Shortcut for use.options
  535. */
  536. options?: RuleSetQuery;
  537. /**
  538. * Options for parsing
  539. */
  540. parser?: {
  541. [k: string]: any;
  542. };
  543. /**
  544. * Shortcut for use.query
  545. */
  546. query?: RuleSetQuery;
  547. /**
  548. * Options for the resolver
  549. */
  550. resolve?: ResolveOptions;
  551. /**
  552. * Match the resource path of the module
  553. */
  554. resource?: RuleSetConditionOrConditionsAbsolute;
  555. /**
  556. * Match the resource query of the module
  557. */
  558. resourceQuery?: RuleSetConditionOrConditions;
  559. /**
  560. * Match and execute these rules when this rule is matched
  561. */
  562. rules?: RuleSetRules;
  563. /**
  564. * Flags a module as with or without side effects
  565. */
  566. sideEffects?: boolean;
  567. /**
  568. * Shortcut for resource.test
  569. */
  570. test?: RuleSetConditionOrConditionsAbsolute;
  571. /**
  572. * Module type to use for the module
  573. */
  574. type?:
  575. | "javascript/auto"
  576. | "javascript/dynamic"
  577. | "javascript/esm"
  578. | "json"
  579. | "webassembly/experimental";
  580. /**
  581. * Modifiers applied to the module when rule is matched
  582. */
  583. use?: RuleSetUse;
  584. }
  585. /**
  586. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  587. * via the `definition` "ResolveOptions".
  588. */
  589. export interface ResolveOptions {
  590. /**
  591. * Redirect module requests
  592. */
  593. alias?:
  594. | {
  595. /**
  596. * New request
  597. */
  598. [k: string]: string;
  599. }
  600. | {
  601. /**
  602. * New request
  603. */
  604. alias?: string;
  605. /**
  606. * Request to be redirected
  607. */
  608. name?: string;
  609. /**
  610. * Redirect only exact matching request
  611. */
  612. onlyModule?: boolean;
  613. }[];
  614. /**
  615. * Fields in the description file (package.json) which are used to redirect requests inside the module
  616. */
  617. aliasFields?: ArrayOfStringOrStringArrayValues;
  618. /**
  619. * Predicate function to decide which requests should be cached
  620. */
  621. cachePredicate?: Function;
  622. /**
  623. * Include the context information in the cache identifier when caching
  624. */
  625. cacheWithContext?: boolean;
  626. /**
  627. * Enable concord resolving extras
  628. */
  629. concord?: boolean;
  630. /**
  631. * Filenames used to find a description file
  632. */
  633. descriptionFiles?: ArrayOfStringValues;
  634. /**
  635. * Enforce using one of the extensions from the extensions option
  636. */
  637. enforceExtension?: boolean;
  638. /**
  639. * Enforce using one of the module extensions from the moduleExtensions option
  640. */
  641. enforceModuleExtension?: boolean;
  642. /**
  643. * Extensions added to the request when trying to find the file
  644. */
  645. extensions?: ArrayOfStringValues;
  646. /**
  647. * Filesystem for the resolver
  648. */
  649. fileSystem?: {
  650. [k: string]: any;
  651. };
  652. /**
  653. * Field names from the description file (package.json) which are used to find the default entry point
  654. */
  655. mainFields?: ArrayOfStringOrStringArrayValues;
  656. /**
  657. * Filenames used to find the default entry point if there is no description file or main field
  658. */
  659. mainFiles?: ArrayOfStringValues;
  660. /**
  661. * Extensions added to the module request when trying to find the module
  662. */
  663. moduleExtensions?: ArrayOfStringValues;
  664. /**
  665. * Folder names or directory paths where to find modules
  666. */
  667. modules?: ArrayOfStringValues;
  668. /**
  669. * Plugins for the resolver
  670. */
  671. plugins?: (WebpackPluginInstance | WebpackPluginFunction)[];
  672. /**
  673. * Custom resolver
  674. */
  675. resolver?: {
  676. [k: string]: any;
  677. };
  678. /**
  679. * Enable resolving symlinks to the original location
  680. */
  681. symlinks?: boolean;
  682. /**
  683. * Enable caching of successfully resolved requests
  684. */
  685. unsafeCache?:
  686. | boolean
  687. | {
  688. [k: string]: any;
  689. };
  690. /**
  691. * Use synchronous filesystem calls for the resolver
  692. */
  693. useSyncFileSystemCalls?: boolean;
  694. }
  695. /**
  696. * Plugin instance
  697. *
  698. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  699. * via the `definition` "WebpackPluginInstance".
  700. */
  701. export interface WebpackPluginInstance {
  702. /**
  703. * The run point of the plugin, required method.
  704. */
  705. apply: (compiler: import("../lib/Compiler")) => void;
  706. [k: string]: any;
  707. }
  708. /**
  709. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  710. * via the `definition` "NodeOptions".
  711. */
  712. export interface NodeOptions {
  713. /**
  714. * Include a polyfill for the 'Buffer' variable
  715. */
  716. Buffer?: false | true | "mock";
  717. /**
  718. * Include a polyfill for the '__dirname' variable
  719. */
  720. __dirname?: false | true | "mock";
  721. /**
  722. * Include a polyfill for the '__filename' variable
  723. */
  724. __filename?: false | true | "mock";
  725. /**
  726. * Include a polyfill for the 'console' variable
  727. */
  728. console?: false | true | "mock";
  729. /**
  730. * Include a polyfill for the 'global' variable
  731. */
  732. global?: boolean;
  733. /**
  734. * Include a polyfill for the 'process' variable
  735. */
  736. process?: false | true | "mock";
  737. /**
  738. * Include a polyfill for the node.js module
  739. */
  740. [k: string]: false | true | "mock" | "empty";
  741. }
  742. /**
  743. * Enables/Disables integrated optimizations
  744. *
  745. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  746. * via the `definition` "OptimizationOptions".
  747. */
  748. export interface OptimizationOptions {
  749. /**
  750. * Check for incompatible wasm types when importing/exporting from/to ESM
  751. */
  752. checkWasmTypes?: boolean;
  753. /**
  754. * Define the algorithm to choose chunk ids (named: readable ids for better debugging, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)
  755. */
  756. chunkIds?: "natural" | "named" | "size" | "total-size" | false;
  757. /**
  758. * Concatenate modules when possible to generate less modules, more efficient code and enable more optimizations by the minimizer
  759. */
  760. concatenateModules?: boolean;
  761. /**
  762. * Also flag chunks as loaded which contain a subset of the modules
  763. */
  764. flagIncludedChunks?: boolean;
  765. /**
  766. * Use hashed module id instead module identifiers for better long term caching (deprecated, used moduleIds: hashed instead)
  767. */
  768. hashedModuleIds?: boolean;
  769. /**
  770. * Reduce size of WASM by changing imports to shorter strings.
  771. */
  772. mangleWasmImports?: boolean;
  773. /**
  774. * Merge chunks which contain the same modules
  775. */
  776. mergeDuplicateChunks?: boolean;
  777. /**
  778. * Enable minimizing the output. Uses optimization.minimizer.
  779. */
  780. minimize?: boolean;
  781. /**
  782. * Minimizer(s) to use for minimizing the output
  783. */
  784. minimizer?: (WebpackPluginInstance | WebpackPluginFunction)[];
  785. /**
  786. * Define the algorithm to choose module ids (natural: numeric ids in order of usage, named: readable ids for better debugging, hashed: short hashes as ids for better long term caching, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)
  787. */
  788. moduleIds?: "natural" | "named" | "hashed" | "size" | "total-size" | false;
  789. /**
  790. * Use readable chunk identifiers for better debugging (deprecated, used chunkIds: named instead)
  791. */
  792. namedChunks?: boolean;
  793. /**
  794. * Use readable module identifiers for better debugging (deprecated, used moduleIds: named instead)
  795. */
  796. namedModules?: boolean;
  797. /**
  798. * Avoid emitting assets when errors occur
  799. */
  800. noEmitOnErrors?: boolean;
  801. /**
  802. * Set process.env.NODE_ENV to a specific value
  803. */
  804. nodeEnv?: false | string;
  805. /**
  806. * Figure out a order of modules which results in the smallest initial bundle
  807. */
  808. occurrenceOrder?: boolean;
  809. /**
  810. * Generate records with relative paths to be able to move the context folder
  811. */
  812. portableRecords?: boolean;
  813. /**
  814. * Figure out which exports are provided by modules to generate more efficient code
  815. */
  816. providedExports?: boolean;
  817. /**
  818. * Removes modules from chunks when these modules are already included in all parents
  819. */
  820. removeAvailableModules?: boolean;
  821. /**
  822. * Remove chunks which are empty
  823. */
  824. removeEmptyChunks?: boolean;
  825. /**
  826. * Create an additional chunk which contains only the webpack runtime and chunk hash maps
  827. */
  828. runtimeChunk?:
  829. | boolean
  830. | ("single" | "multiple")
  831. | {
  832. /**
  833. * The name or name factory for the runtime chunks
  834. */
  835. name?: string | Function;
  836. };
  837. /**
  838. * Skip over modules which are flagged to contain no side effects when exports are not used
  839. */
  840. sideEffects?: boolean;
  841. /**
  842. * Optimize duplication and caching by splitting chunks by shared modules and cache group
  843. */
  844. splitChunks?: false | OptimizationSplitChunksOptions;
  845. /**
  846. * Figure out which exports are used by modules to mangle export names, omit unused exports and generate more efficient code
  847. */
  848. usedExports?: boolean;
  849. }
  850. /**
  851. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  852. * via the `definition` "OptimizationSplitChunksOptions".
  853. */
  854. export interface OptimizationSplitChunksOptions {
  855. /**
  856. * Sets the name delimiter for created chunks
  857. */
  858. automaticNameDelimiter?: string;
  859. /**
  860. * Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks)
  861. */
  862. cacheGroups?: {
  863. /**
  864. * Configuration for a cache group
  865. */
  866. [k: string]:
  867. | false
  868. | Function
  869. | string
  870. | RegExp
  871. | {
  872. /**
  873. * Sets the name delimiter for created chunks
  874. */
  875. automaticNameDelimiter?: string;
  876. /**
  877. * Sets the name prefix for created chunks
  878. */
  879. automaticNamePrefix?: string;
  880. /**
  881. * Select chunks for determining cache group content (defaults to "initial", "initial" and "all" requires adding these chunks to the HTML)
  882. */
  883. chunks?: ("initial" | "async" | "all") | Function;
  884. /**
  885. * Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group
  886. */
  887. enforce?: boolean;
  888. /**
  889. * Sets the template for the filename for created chunks (Only works for initial chunks)
  890. */
  891. filename?: string;
  892. /**
  893. * Maximum number of requests which are accepted for on-demand loading
  894. */
  895. maxAsyncRequests?: number;
  896. /**
  897. * Maximum number of initial chunks which are accepted for an entry point
  898. */
  899. maxInitialRequests?: number;
  900. /**
  901. * Maximal size hint for the created chunks
  902. */
  903. maxSize?: number;
  904. /**
  905. * Minimum number of times a module has to be duplicated until it's considered for splitting
  906. */
  907. minChunks?: number;
  908. /**
  909. * Minimal size for the created chunk
  910. */
  911. minSize?: number;
  912. /**
  913. * Give chunks for this cache group a name (chunks with equal name are merged)
  914. */
  915. name?: boolean | Function | string;
  916. /**
  917. * Priority of this cache group
  918. */
  919. priority?: number;
  920. /**
  921. * Try to reuse existing chunk (with name) when it has matching modules
  922. */
  923. reuseExistingChunk?: boolean;
  924. /**
  925. * Assign modules to a cache group
  926. */
  927. test?: Function | string | RegExp;
  928. };
  929. };
  930. /**
  931. * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML)
  932. */
  933. chunks?: ("initial" | "async" | "all") | Function;
  934. /**
  935. * Options for modules not selected by any other cache group
  936. */
  937. fallbackCacheGroup?: {
  938. /**
  939. * Sets the name delimiter for created chunks
  940. */
  941. automaticNameDelimiter?: string;
  942. /**
  943. * Maximal size hint for the created chunks
  944. */
  945. maxSize?: number;
  946. /**
  947. * Minimal size for the created chunk
  948. */
  949. minSize?: number;
  950. };
  951. /**
  952. * Sets the template for the filename for created chunks (Only works for initial chunks)
  953. */
  954. filename?: string;
  955. /**
  956. * Prevents exposing path info when creating names for parts splitted by maxSize
  957. */
  958. hidePathInfo?: boolean;
  959. /**
  960. * Maximum number of requests which are accepted for on-demand loading
  961. */
  962. maxAsyncRequests?: number;
  963. /**
  964. * Maximum number of initial chunks which are accepted for an entry point
  965. */
  966. maxInitialRequests?: number;
  967. /**
  968. * Maximal size hint for the created chunks
  969. */
  970. maxSize?: number;
  971. /**
  972. * Minimum number of times a module has to be duplicated until it's considered for splitting
  973. */
  974. minChunks?: number;
  975. /**
  976. * Minimal size for the created chunks
  977. */
  978. minSize?: number;
  979. /**
  980. * Give chunks created a name (chunks with equal name are merged)
  981. */
  982. name?: boolean | Function | string;
  983. }
  984. /**
  985. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  986. * via the `definition` "OutputOptions".
  987. */
  988. export interface OutputOptions {
  989. /**
  990. * Add a comment in the UMD wrapper.
  991. */
  992. auxiliaryComment?:
  993. | string
  994. | {
  995. /**
  996. * Set comment for `amd` section in UMD
  997. */
  998. amd?: string;
  999. /**
  1000. * Set comment for `commonjs` (exports) section in UMD
  1001. */
  1002. commonjs?: string;
  1003. /**
  1004. * Set comment for `commonjs2` (module.exports) section in UMD
  1005. */
  1006. commonjs2?: string;
  1007. /**
  1008. * Set comment for `root` (global variable) section in UMD
  1009. */
  1010. root?: string;
  1011. };
  1012. /**
  1013. * The callback function name used by webpack for loading of chunks in WebWorkers.
  1014. */
  1015. chunkCallbackName?: string;
  1016. /**
  1017. * The filename of non-entry chunks as relative path inside the `output.path` directory.
  1018. */
  1019. chunkFilename?: string;
  1020. /**
  1021. * Number of milliseconds before chunk request expires
  1022. */
  1023. chunkLoadTimeout?: number;
  1024. /**
  1025. * This option enables cross-origin loading of chunks.
  1026. */
  1027. crossOriginLoading?: false | "anonymous" | "use-credentials";
  1028. /**
  1029. * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
  1030. */
  1031. devtoolFallbackModuleFilenameTemplate?: string | Function;
  1032. /**
  1033. * Enable line to line mapped mode for all/specified modules. Line to line mapped mode uses a simple SourceMap where each line of the generated source is mapped to the same line of the original source. It’s a performance optimization. Only use it if your performance need to be better and you are sure that input lines match which generated lines.
  1034. */
  1035. devtoolLineToLine?:
  1036. | boolean
  1037. | {
  1038. [k: string]: any;
  1039. };
  1040. /**
  1041. * Filename template string of function for the sources array in a generated SourceMap.
  1042. */
  1043. devtoolModuleFilenameTemplate?: string | Function;
  1044. /**
  1045. * 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.
  1046. */
  1047. devtoolNamespace?: string;
  1048. /**
  1049. * Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
  1050. */
  1051. filename?: string | Function;
  1052. /**
  1053. * An expression which is used to address the global object/scope in runtime code
  1054. */
  1055. globalObject?: string;
  1056. /**
  1057. * Digest type used for the hash
  1058. */
  1059. hashDigest?: string;
  1060. /**
  1061. * Number of chars which are used for the hash
  1062. */
  1063. hashDigestLength?: number;
  1064. /**
  1065. * Algorithm used for generation the hash (see node.js crypto package)
  1066. */
  1067. hashFunction?: string | (new () => import("../lib/util/createHash").Hash);
  1068. /**
  1069. * Any string which is added to the hash to salt it
  1070. */
  1071. hashSalt?: string;
  1072. /**
  1073. * The filename of the Hot Update Chunks. They are inside the output.path directory.
  1074. */
  1075. hotUpdateChunkFilename?: string | Function;
  1076. /**
  1077. * The JSONP function used by webpack for async loading of hot update chunks.
  1078. */
  1079. hotUpdateFunction?: string;
  1080. /**
  1081. * The filename of the Hot Update Main File. It is inside the `output.path` directory.
  1082. */
  1083. hotUpdateMainFilename?: string | Function;
  1084. /**
  1085. * The JSONP function used by webpack for async loading of chunks.
  1086. */
  1087. jsonpFunction?: string;
  1088. /**
  1089. * This option enables loading async chunks via a custom script type, such as script type="module"
  1090. */
  1091. jsonpScriptType?: false | "text/javascript" | "module";
  1092. /**
  1093. * If set, export the bundle as library. `output.library` is the name.
  1094. */
  1095. library?: string | string[] | LibraryCustomUmdObject;
  1096. /**
  1097. * Specify which export should be exposed as library
  1098. */
  1099. libraryExport?: string | ArrayOfStringValues;
  1100. /**
  1101. * Type of library
  1102. */
  1103. libraryTarget?:
  1104. | "var"
  1105. | "assign"
  1106. | "this"
  1107. | "window"
  1108. | "self"
  1109. | "global"
  1110. | "commonjs"
  1111. | "commonjs2"
  1112. | "commonjs-module"
  1113. | "amd"
  1114. | "amd-require"
  1115. | "umd"
  1116. | "umd2"
  1117. | "jsonp";
  1118. /**
  1119. * The output directory as **absolute path** (required).
  1120. */
  1121. path?: string;
  1122. /**
  1123. * Include comments with information about the modules.
  1124. */
  1125. pathinfo?: boolean;
  1126. /**
  1127. * The `publicPath` specifies the public URL address of the output files when referenced in a browser.
  1128. */
  1129. publicPath?: string | Function;
  1130. /**
  1131. * The filename of the SourceMaps for the JavaScript files. They are inside the `output.path` directory.
  1132. */
  1133. sourceMapFilename?: string;
  1134. /**
  1135. * Prefixes every line of the source in the bundle with this string.
  1136. */
  1137. sourcePrefix?: string;
  1138. /**
  1139. * Handles exceptions in module loading correctly at a performance cost.
  1140. */
  1141. strictModuleExceptionHandling?: boolean;
  1142. /**
  1143. * If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
  1144. */
  1145. umdNamedDefine?: boolean;
  1146. /**
  1147. * The filename of WebAssembly modules as relative path inside the `output.path` directory.
  1148. */
  1149. webassemblyModuleFilename?: string;
  1150. }
  1151. /**
  1152. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  1153. * via the `definition` "LibraryCustomUmdObject".
  1154. */
  1155. export interface LibraryCustomUmdObject {
  1156. /**
  1157. * Name of the exposed AMD library in the UMD
  1158. */
  1159. amd?: string;
  1160. /**
  1161. * Name of the exposed commonjs export in the UMD
  1162. */
  1163. commonjs?: string;
  1164. /**
  1165. * Name of the property exposed globally by a UMD library
  1166. */
  1167. root?: string | ArrayOfStringValues;
  1168. }
  1169. /**
  1170. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  1171. * via the `definition` "PerformanceOptions".
  1172. */
  1173. export interface PerformanceOptions {
  1174. /**
  1175. * Filter function to select assets that are checked
  1176. */
  1177. assetFilter?: Function;
  1178. /**
  1179. * Sets the format of the hints: warnings, errors or nothing at all
  1180. */
  1181. hints?: false | "warning" | "error";
  1182. /**
  1183. * Filesize limit (in bytes) when exceeded, that webpack will provide performance hints
  1184. */
  1185. maxAssetSize?: number;
  1186. /**
  1187. * Total size of an entry point (in bytes)
  1188. */
  1189. maxEntrypointSize?: number;
  1190. }
  1191. /**
  1192. * This interface was referenced by `WebpackOptions`'s JSON-Schema
  1193. * via the `definition` "StatsOptions".
  1194. */
  1195. export interface StatsOptions {
  1196. /**
  1197. * fallback value for stats options when an option is not defined (has precedence over local webpack defaults)
  1198. */
  1199. all?: boolean;
  1200. /**
  1201. * add assets information
  1202. */
  1203. assets?: boolean;
  1204. /**
  1205. * sort the assets by that field
  1206. */
  1207. assetsSort?: string;
  1208. /**
  1209. * add built at time information
  1210. */
  1211. builtAt?: boolean;
  1212. /**
  1213. * add also information about cached (not built) modules
  1214. */
  1215. cached?: boolean;
  1216. /**
  1217. * Show cached assets (setting this to `false` only shows emitted files)
  1218. */
  1219. cachedAssets?: boolean;
  1220. /**
  1221. * add children information
  1222. */
  1223. children?: boolean;
  1224. /**
  1225. * Display all chunk groups with the corresponding bundles
  1226. */
  1227. chunkGroups?: boolean;
  1228. /**
  1229. * add built modules information to chunk information
  1230. */
  1231. chunkModules?: boolean;
  1232. /**
  1233. * add the origins of chunks and chunk merging info
  1234. */
  1235. chunkOrigins?: boolean;
  1236. /**
  1237. * add chunk information
  1238. */
  1239. chunks?: boolean;
  1240. /**
  1241. * sort the chunks by that field
  1242. */
  1243. chunksSort?: string;
  1244. /**
  1245. * Enables/Disables colorful output
  1246. */
  1247. colors?:
  1248. | boolean
  1249. | {
  1250. /**
  1251. * Custom color for bold text
  1252. */
  1253. bold?: string;
  1254. /**
  1255. * Custom color for cyan text
  1256. */
  1257. cyan?: string;
  1258. /**
  1259. * Custom color for green text
  1260. */
  1261. green?: string;
  1262. /**
  1263. * Custom color for magenta text
  1264. */
  1265. magenta?: string;
  1266. /**
  1267. * Custom color for red text
  1268. */
  1269. red?: string;
  1270. /**
  1271. * Custom color for yellow text
  1272. */
  1273. yellow?: string;
  1274. };
  1275. /**
  1276. * context directory for request shortening
  1277. */
  1278. context?: string;
  1279. /**
  1280. * add module depth in module graph
  1281. */
  1282. depth?: boolean;
  1283. /**
  1284. * Display the entry points with the corresponding bundles
  1285. */
  1286. entrypoints?: boolean;
  1287. /**
  1288. * add --env information
  1289. */
  1290. env?: boolean;
  1291. /**
  1292. * add details to errors (like resolving log)
  1293. */
  1294. errorDetails?: boolean;
  1295. /**
  1296. * add errors
  1297. */
  1298. errors?: boolean;
  1299. /**
  1300. * Please use excludeModules instead.
  1301. */
  1302. exclude?: FilterTypes | boolean;
  1303. /**
  1304. * Suppress assets that match the specified filters. Filters can be Strings, RegExps or Functions
  1305. */
  1306. excludeAssets?: FilterTypes;
  1307. /**
  1308. * Suppress modules that match the specified filters. Filters can be Strings, RegExps, Booleans or Functions
  1309. */
  1310. excludeModules?: FilterTypes | boolean;
  1311. /**
  1312. * add the hash of the compilation
  1313. */
  1314. hash?: boolean;
  1315. /**
  1316. * Set the maximum number of modules to be shown
  1317. */
  1318. maxModules?: number;
  1319. /**
  1320. * add information about assets inside modules
  1321. */
  1322. moduleAssets?: boolean;
  1323. /**
  1324. * add dependencies and origin of warnings/errors
  1325. */
  1326. moduleTrace?: boolean;
  1327. /**
  1328. * add built modules information
  1329. */
  1330. modules?: boolean;
  1331. /**
  1332. * sort the modules by that field
  1333. */
  1334. modulesSort?: string;
  1335. /**
  1336. * add information about modules nested in other modules (like with module concatenation)
  1337. */
  1338. nestedModules?: boolean;
  1339. /**
  1340. * show reasons why optimization bailed out for modules
  1341. */
  1342. optimizationBailout?: boolean;
  1343. /**
  1344. * Add output path information
  1345. */
  1346. outputPath?: boolean;
  1347. /**
  1348. * add performance hint flags
  1349. */
  1350. performance?: boolean;
  1351. /**
  1352. * show exports provided by modules
  1353. */
  1354. providedExports?: boolean;
  1355. /**
  1356. * Add public path information
  1357. */
  1358. publicPath?: boolean;
  1359. /**
  1360. * add information about the reasons why modules are included
  1361. */
  1362. reasons?: boolean;
  1363. /**
  1364. * add the source code of modules
  1365. */
  1366. source?: boolean;
  1367. /**
  1368. * add timing information
  1369. */
  1370. timings?: boolean;
  1371. /**
  1372. * show exports used by modules
  1373. */
  1374. usedExports?: boolean;
  1375. /**
  1376. * add webpack version information
  1377. */
  1378. version?: boolean;
  1379. /**
  1380. * add warnings
  1381. */
  1382. warnings?: boolean;
  1383. /**
  1384. * Suppress warnings that match the specified filters. Filters can be Strings, RegExps or Functions
  1385. */
  1386. warningsFilter?: FilterTypes;
  1387. }