webpack 5.99.8 → 5.100.0
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/README.md +0 -3
- package/bin/webpack.js +8 -2
- package/hot/log.js +15 -15
- package/hot/poll.js +1 -0
- package/lib/APIPlugin.js +3 -3
- package/lib/AbstractMethodError.js +1 -0
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +1 -1
- package/lib/CacheFacade.js +2 -1
- package/lib/CaseSensitiveModulesWarning.js +4 -4
- package/lib/Chunk.js +6 -6
- package/lib/ChunkGraph.js +37 -32
- package/lib/ChunkGroup.js +17 -10
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +94 -17
- package/lib/CodeGenerationResults.js +1 -1
- package/lib/CompatibilityPlugin.js +5 -2
- package/lib/Compilation.js +77 -71
- package/lib/Compiler.js +46 -16
- package/lib/ConcatenationScope.js +15 -6
- package/lib/ConstPlugin.js +65 -45
- package/lib/ContextModule.js +16 -12
- package/lib/ContextModuleFactory.js +4 -3
- package/lib/ContextReplacementPlugin.js +4 -2
- package/lib/CssModule.js +2 -3
- package/lib/DefinePlugin.js +111 -3
- package/lib/DelegatedModuleFactoryPlugin.js +18 -18
- package/lib/Dependency.js +16 -12
- package/lib/DependencyTemplate.js +1 -0
- package/lib/DllEntryPlugin.js +3 -1
- package/lib/DllPlugin.js +4 -3
- package/lib/DllReferencePlugin.js +2 -2
- package/lib/DynamicEntryPlugin.js +1 -1
- package/lib/EntryOptionPlugin.js +5 -0
- package/lib/ErrorHelpers.js +4 -4
- package/lib/EvalDevToolModulePlugin.js +3 -3
- package/lib/EvalSourceMapDevToolPlugin.js +7 -7
- package/lib/ExportsInfo.js +48 -39
- package/lib/ExternalModule.js +15 -11
- package/lib/ExternalModuleFactoryPlugin.js +5 -2
- package/lib/FileSystemInfo.js +51 -38
- package/lib/FlagDependencyExportsPlugin.js +14 -7
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +14 -1
- package/lib/HookWebpackError.js +1 -0
- package/lib/HotModuleReplacementPlugin.js +77 -50
- package/lib/IgnorePlugin.js +1 -1
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +0 -1
- package/lib/LibManifestPlugin.js +4 -2
- package/lib/LoaderOptionsPlugin.js +6 -4
- package/lib/MainTemplate.js +2 -2
- package/lib/Module.js +21 -6
- package/lib/ModuleFactory.js +1 -0
- package/lib/ModuleGraph.js +24 -2
- package/lib/ModuleGraphConnection.js +5 -5
- package/lib/ModuleInfoHeaderPlugin.js +2 -1
- package/lib/ModuleParseError.js +1 -0
- package/lib/ModuleSourceTypesConstants.js +12 -12
- package/lib/ModuleTemplate.js +1 -1
- package/lib/ModuleTypeConstants.js +21 -21
- package/lib/MultiCompiler.js +6 -6
- package/lib/NormalModule.js +61 -56
- package/lib/NormalModuleFactory.js +52 -37
- package/lib/NormalModuleReplacementPlugin.js +1 -1
- package/lib/NullFactory.js +1 -0
- package/lib/OptimizationStages.js +1 -1
- package/lib/Parser.js +1 -0
- package/lib/ProgressPlugin.js +12 -5
- package/lib/ProvidePlugin.js +5 -1
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/RuntimeGlobals.js +175 -155
- package/lib/RuntimeModule.js +1 -0
- package/lib/RuntimePlugin.js +34 -8
- package/lib/RuntimeTemplate.js +111 -11
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +15 -25
- package/lib/SourceMapDevToolPlugin.js +19 -17
- package/lib/Template.js +2 -2
- package/lib/TemplatedPathPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +7 -8
- package/lib/WatchIgnorePlugin.js +4 -3
- package/lib/WebpackIsIncludedPlugin.js +2 -1
- package/lib/WebpackOptionsApply.js +115 -27
- package/lib/asset/AssetGenerator.js +26 -21
- package/lib/asset/AssetModulesPlugin.js +19 -17
- package/lib/asset/AssetSourceGenerator.js +11 -9
- package/lib/asset/RawDataUrlModule.js +4 -2
- package/lib/async-modules/AwaitDependenciesInitFragment.js +1 -1
- package/lib/buildChunkGraph.js +6 -3
- package/lib/cache/AddBuildDependenciesPlugin.js +5 -6
- package/lib/cache/IdleFileCachePlugin.js +7 -4
- package/lib/cache/MemoryCachePlugin.js +1 -0
- package/lib/cache/MemoryWithGcCachePlugin.js +1 -0
- package/lib/cache/PackFileCacheStrategy.js +26 -20
- package/lib/cache/ResolverCachePlugin.js +16 -8
- package/lib/cli.js +15 -10
- package/lib/config/browserslistTargetHandler.js +3 -3
- package/lib/config/defaults.js +25 -17
- package/lib/config/normalization.js +2 -1
- package/lib/config/target.js +6 -5
- package/lib/container/ContainerPlugin.js +1 -1
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/container/FallbackModule.js +2 -1
- package/lib/container/HoistContainerReferencesPlugin.js +1 -1
- package/lib/container/ModuleFederationPlugin.js +2 -2
- package/lib/container/RemoteModule.js +1 -1
- package/lib/css/CssGenerator.js +9 -6
- package/lib/css/CssModulesPlugin.js +44 -31
- package/lib/css/CssParser.js +6 -4
- package/lib/css/walkCssTokens.js +33 -37
- package/lib/debug/ProfilingPlugin.js +6 -6
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -8
- package/lib/dependencies/AMDPlugin.js +12 -8
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +28 -26
- package/lib/dependencies/CachedConstDependency.js +1 -5
- package/lib/dependencies/CommonJsExportRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsExportsParserPlugin.js +22 -25
- package/lib/dependencies/CommonJsFullRequireDependency.js +1 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +100 -114
- package/lib/dependencies/CommonJsPlugin.js +15 -16
- package/lib/dependencies/ContextDependencyHelpers.js +2 -1
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/lib/dependencies/CssIcssExportDependency.js +1 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/CssUrlDependency.js +1 -1
- package/lib/dependencies/DynamicExports.js +9 -9
- package/lib/dependencies/ExportsInfoDependency.js +1 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +122 -101
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +95 -19
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +11 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +238 -162
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +20 -9
- package/lib/dependencies/HarmonyModulesPlugin.js +23 -12
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -0
- package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
- package/lib/dependencies/ImportMetaPlugin.js +2 -2
- package/lib/dependencies/ImportParserPlugin.js +40 -9
- package/lib/dependencies/ImportPlugin.js +3 -1
- package/lib/dependencies/LoaderPlugin.js +1 -0
- package/lib/dependencies/ModuleDependency.js +1 -1
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +3 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +3 -0
- package/lib/dependencies/RequireEnsurePlugin.js +6 -6
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +33 -34
- package/lib/dependencies/RequireIncludePlugin.js +1 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/URLContextDependency.js +65 -0
- package/lib/dependencies/URLDependency.js +1 -1
- package/lib/dependencies/URLPlugin.js +17 -157
- package/lib/dependencies/WorkerPlugin.js +23 -10
- package/lib/dependencies/processExportInfo.js +2 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +269 -185
- package/lib/esm/ModuleChunkLoadingPlugin.js +39 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +73 -6
- package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +37 -0
- package/lib/hmr/LazyCompilationPlugin.js +4 -2
- package/lib/hmr/lazyCompilationBackend.js +4 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +6 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +30 -35
- package/lib/ids/DeterministicModuleIdsPlugin.js +4 -3
- package/lib/ids/HashedModuleIdsPlugin.js +5 -4
- package/lib/ids/IdHelpers.js +21 -17
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +4 -4
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +3 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +1 -1
- package/lib/index.js +13 -3
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +113 -119
- package/lib/javascript/BasicEvaluatedExpression.js +2 -1
- package/lib/javascript/ChunkHelpers.js +1 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +121 -136
- package/lib/javascript/EnableChunkLoadingPlugin.js +6 -3
- package/lib/javascript/JavascriptGenerator.js +14 -2
- package/lib/javascript/JavascriptModulesPlugin.js +68 -27
- package/lib/javascript/JavascriptParser.js +136 -81
- package/lib/javascript/JavascriptParserHelpers.js +41 -41
- package/lib/javascript/StartupHelpers.js +17 -17
- package/lib/json/JsonGenerator.js +4 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/json/JsonParser.js +1 -1
- package/lib/library/AbstractLibraryPlugin.js +6 -2
- package/lib/library/AssignLibraryPlugin.js +21 -6
- package/lib/library/EnableLibraryPlugin.js +23 -3
- package/lib/library/ModuleLibraryPlugin.js +4 -1
- package/lib/library/UmdLibraryPlugin.js +15 -6
- package/lib/logging/createConsoleLogger.js +3 -3
- package/lib/logging/runtime.js +9 -9
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/RequireChunkLoadingRuntimeModule.js +4 -22
- package/lib/node/nodeConsole.js +4 -2
- package/lib/optimize/AggressiveMergingPlugin.js +45 -46
- package/lib/optimize/AggressiveSplittingPlugin.js +13 -12
- package/lib/optimize/ConcatenatedModule.js +227 -57
- package/lib/optimize/EnsureChunkConditionsPlugin.js +58 -58
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -1
- package/lib/optimize/InnerGraph.js +115 -112
- package/lib/optimize/InnerGraphPlugin.js +2 -2
- package/lib/optimize/LimitChunkCountPlugin.js +4 -2
- package/lib/optimize/MangleExportsPlugin.js +4 -3
- package/lib/optimize/MergeDuplicateChunksPlugin.js +80 -81
- package/lib/optimize/MinChunkSizePlugin.js +6 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +31 -22
- package/lib/optimize/RealContentHashPlugin.js +26 -20
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/SideEffectsFlagPlugin.js +6 -3
- package/lib/optimize/SplitChunksPlugin.js +16 -13
- package/lib/rules/BasicEffectRulePlugin.js +4 -2
- package/lib/rules/BasicMatcherRulePlugin.js +3 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +3 -1
- package/lib/rules/RuleSetCompiler.js +7 -4
- package/lib/rules/UseEffectRulePlugin.js +3 -1
- package/lib/runtime/AsyncModuleRuntimeModule.js +64 -9
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +214 -0
- package/lib/runtime/RuntimeIdRuntimeModule.js +2 -1
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +8 -7
- package/lib/schemes/DataUriPlugin.js +3 -1
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +27 -19
- package/lib/schemes/VirtualUrlPlugin.js +222 -0
- package/lib/serialization/AggregateErrorSerializer.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +5 -4
- package/lib/serialization/FileMiddleware.js +7 -4
- package/lib/serialization/ObjectMiddleware.js +14 -8
- package/lib/serialization/Serializer.js +5 -3
- package/lib/serialization/SerializerMiddleware.js +2 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +3 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +2 -2
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +6 -3
- package/lib/sharing/SharePlugin.js +2 -1
- package/lib/sharing/ShareRuntimeModule.js +3 -5
- package/lib/sharing/utils.js +34 -34
- package/lib/stats/DefaultStatsFactoryPlugin.js +49 -46
- package/lib/stats/DefaultStatsPresetPlugin.js +4 -2
- package/lib/stats/DefaultStatsPrinterPlugin.js +28 -22
- package/lib/stats/StatsFactory.js +4 -2
- package/lib/stats/StatsPrinter.js +3 -2
- package/lib/url/URLParserPlugin.js +266 -0
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Hash.js +2 -0
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazyBucketSortedSet.js +2 -1
- package/lib/util/LazySet.js +11 -6
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/SetHelpers.js +3 -3
- package/lib/util/SortableSet.js +2 -2
- package/lib/util/StackedCacheMap.js +3 -1
- package/lib/util/StackedMap.js +2 -2
- package/lib/util/StringXor.js +1 -0
- package/lib/util/TupleSet.js +1 -0
- package/lib/util/URLAbsoluteSpecifier.js +1 -1
- package/lib/util/cleverMerge.js +12 -8
- package/lib/util/comparators.js +154 -127
- package/lib/util/compileBooleanMatcher.js +8 -3
- package/lib/util/concatenate.js +8 -7
- package/lib/util/conventions.js +72 -73
- package/lib/util/create-schema-validation.js +2 -1
- package/lib/util/createHash.js +10 -4
- package/lib/util/deprecation.js +69 -66
- package/lib/util/deterministicGrouping.js +4 -2
- package/lib/util/extractUrlAndGlobal.js +1 -1
- package/lib/util/findGraphRoots.js +2 -2
- package/lib/util/fs.js +30 -23
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/wasm-hash.js +4 -2
- package/lib/util/identifier.js +13 -12
- package/lib/util/internalSerializables.js +2 -0
- package/lib/util/magicComment.js +5 -5
- package/lib/util/processAsyncTree.js +1 -1
- package/lib/util/propertyAccess.js +1 -1
- package/lib/util/propertyName.js +1 -1
- package/lib/util/registerExternalSerializer.js +1 -2
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +29 -21
- package/lib/util/semver.js +1 -1
- package/lib/util/serialization.js +3 -0
- package/lib/util/source.js +3 -2
- package/lib/validateSchema.js +1 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +6 -3
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -1
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +46 -49
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +2 -3
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +3 -2
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +3 -0
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -22
- package/lib/webpack.js +4 -5
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +1 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -24
- package/lib/webworker/WebWorkerTemplatePlugin.js +1 -0
- package/package.json +121 -114
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +17 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.d.ts +7 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +6 -0
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +77 -0
- package/types.d.ts +1261 -366
|
@@ -5,51 +5,68 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const APIPlugin = require("./APIPlugin");
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
|
12
|
-
const JsonModulesPlugin = require("./json/JsonModulesPlugin");
|
|
10
|
+
const CompatibilityPlugin = require("./CompatibilityPlugin");
|
|
13
11
|
|
|
14
|
-
const
|
|
12
|
+
const ConstPlugin = require("./ConstPlugin");
|
|
15
13
|
|
|
16
14
|
const EntryOptionPlugin = require("./EntryOptionPlugin");
|
|
15
|
+
|
|
16
|
+
const ExportsInfoApiPlugin = require("./ExportsInfoApiPlugin");
|
|
17
|
+
const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin");
|
|
18
|
+
|
|
19
|
+
const JavascriptMetaInfoPlugin = require("./JavascriptMetaInfoPlugin");
|
|
20
|
+
|
|
21
|
+
const OptionsApply = require("./OptionsApply");
|
|
22
|
+
|
|
17
23
|
const RecordIdsPlugin = require("./RecordIdsPlugin");
|
|
18
24
|
|
|
19
25
|
const RuntimePlugin = require("./RuntimePlugin");
|
|
20
26
|
|
|
21
|
-
const APIPlugin = require("./APIPlugin");
|
|
22
|
-
const CompatibilityPlugin = require("./CompatibilityPlugin");
|
|
23
|
-
const ConstPlugin = require("./ConstPlugin");
|
|
24
|
-
const ExportsInfoApiPlugin = require("./ExportsInfoApiPlugin");
|
|
25
|
-
const WebpackIsIncludedPlugin = require("./WebpackIsIncludedPlugin");
|
|
26
|
-
|
|
27
27
|
const TemplatedPathPlugin = require("./TemplatedPathPlugin");
|
|
28
|
+
|
|
28
29
|
const UseStrictPlugin = require("./UseStrictPlugin");
|
|
30
|
+
|
|
29
31
|
const WarnCaseSensitiveModulesPlugin = require("./WarnCaseSensitiveModulesPlugin");
|
|
30
32
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
+
const WebpackIsIncludedPlugin = require("./WebpackIsIncludedPlugin");
|
|
34
|
+
|
|
35
|
+
const AssetModulesPlugin = require("./asset/AssetModulesPlugin");
|
|
36
|
+
|
|
37
|
+
const InferAsyncModulesPlugin = require("./async-modules/InferAsyncModulesPlugin");
|
|
33
38
|
|
|
34
39
|
const ResolverCachePlugin = require("./cache/ResolverCachePlugin");
|
|
35
40
|
|
|
36
41
|
const CommonJsPlugin = require("./dependencies/CommonJsPlugin");
|
|
42
|
+
|
|
37
43
|
const HarmonyModulesPlugin = require("./dependencies/HarmonyModulesPlugin");
|
|
44
|
+
|
|
38
45
|
const ImportMetaContextPlugin = require("./dependencies/ImportMetaContextPlugin");
|
|
39
46
|
const ImportMetaPlugin = require("./dependencies/ImportMetaPlugin");
|
|
47
|
+
|
|
40
48
|
const ImportPlugin = require("./dependencies/ImportPlugin");
|
|
41
49
|
const LoaderPlugin = require("./dependencies/LoaderPlugin");
|
|
50
|
+
|
|
42
51
|
const RequireContextPlugin = require("./dependencies/RequireContextPlugin");
|
|
43
52
|
const RequireEnsurePlugin = require("./dependencies/RequireEnsurePlugin");
|
|
44
53
|
const RequireIncludePlugin = require("./dependencies/RequireIncludePlugin");
|
|
54
|
+
|
|
45
55
|
const SystemPlugin = require("./dependencies/SystemPlugin");
|
|
56
|
+
|
|
46
57
|
const URLPlugin = require("./dependencies/URLPlugin");
|
|
58
|
+
|
|
47
59
|
const WorkerPlugin = require("./dependencies/WorkerPlugin");
|
|
48
60
|
|
|
49
|
-
const
|
|
61
|
+
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
|
62
|
+
|
|
63
|
+
const JsonModulesPlugin = require("./json/JsonModulesPlugin");
|
|
64
|
+
|
|
65
|
+
const ChunkPrefetchPreloadPlugin = require("./prefetch/ChunkPrefetchPreloadPlugin");
|
|
66
|
+
|
|
67
|
+
const DataUriPlugin = require("./schemes/DataUriPlugin");
|
|
68
|
+
const FileUriPlugin = require("./schemes/FileUriPlugin");
|
|
50
69
|
|
|
51
|
-
const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin");
|
|
52
|
-
const JavascriptMetaInfoPlugin = require("./JavascriptMetaInfoPlugin");
|
|
53
70
|
const DefaultStatsFactoryPlugin = require("./stats/DefaultStatsFactoryPlugin");
|
|
54
71
|
const DefaultStatsPresetPlugin = require("./stats/DefaultStatsPresetPlugin");
|
|
55
72
|
const DefaultStatsPrinterPlugin = require("./stats/DefaultStatsPrinterPlugin");
|
|
@@ -84,6 +101,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
84
101
|
if (options.externals) {
|
|
85
102
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
86
103
|
const ExternalsPlugin = require("./ExternalsPlugin");
|
|
104
|
+
|
|
87
105
|
new ExternalsPlugin(options.externalsType, options.externals).apply(
|
|
88
106
|
compiler
|
|
89
107
|
);
|
|
@@ -91,21 +109,25 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
91
109
|
|
|
92
110
|
if (options.externalsPresets.node) {
|
|
93
111
|
const NodeTargetPlugin = require("./node/NodeTargetPlugin");
|
|
112
|
+
|
|
94
113
|
new NodeTargetPlugin().apply(compiler);
|
|
95
114
|
}
|
|
96
115
|
if (options.externalsPresets.electronMain) {
|
|
97
116
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
98
117
|
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
|
|
118
|
+
|
|
99
119
|
new ElectronTargetPlugin("main").apply(compiler);
|
|
100
120
|
}
|
|
101
121
|
if (options.externalsPresets.electronPreload) {
|
|
102
122
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
103
123
|
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
|
|
124
|
+
|
|
104
125
|
new ElectronTargetPlugin("preload").apply(compiler);
|
|
105
126
|
}
|
|
106
127
|
if (options.externalsPresets.electronRenderer) {
|
|
107
128
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
108
129
|
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
|
|
130
|
+
|
|
109
131
|
new ElectronTargetPlugin("renderer").apply(compiler);
|
|
110
132
|
}
|
|
111
133
|
if (
|
|
@@ -116,29 +138,35 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
116
138
|
) {
|
|
117
139
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
118
140
|
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
|
|
141
|
+
|
|
119
142
|
new ElectronTargetPlugin().apply(compiler);
|
|
120
143
|
}
|
|
121
144
|
if (options.externalsPresets.nwjs) {
|
|
122
145
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
123
146
|
const ExternalsPlugin = require("./ExternalsPlugin");
|
|
147
|
+
|
|
124
148
|
new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler);
|
|
125
149
|
}
|
|
126
150
|
if (options.externalsPresets.webAsync) {
|
|
127
151
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
128
152
|
const ExternalsPlugin = require("./ExternalsPlugin");
|
|
153
|
+
|
|
129
154
|
new ExternalsPlugin("import", ({ request, dependencyType }, callback) => {
|
|
130
155
|
if (dependencyType === "url") {
|
|
131
|
-
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request)))
|
|
156
|
+
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
|
|
132
157
|
return callback(null, `asset ${request}`);
|
|
158
|
+
}
|
|
133
159
|
} else if (options.experiments.css && dependencyType === "css-import") {
|
|
134
|
-
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request)))
|
|
160
|
+
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
|
|
135
161
|
return callback(null, `css-import ${request}`);
|
|
162
|
+
}
|
|
136
163
|
} else if (
|
|
137
164
|
options.experiments.css &&
|
|
138
165
|
/^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request))
|
|
139
166
|
) {
|
|
140
|
-
if (/^\.css(\?|$)/.test(/** @type {string} */ (request)))
|
|
167
|
+
if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) {
|
|
141
168
|
return callback(null, `css-import ${request}`);
|
|
169
|
+
}
|
|
142
170
|
return callback(null, `import ${request}`);
|
|
143
171
|
}
|
|
144
172
|
callback();
|
|
@@ -146,21 +174,25 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
146
174
|
} else if (options.externalsPresets.web) {
|
|
147
175
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
148
176
|
const ExternalsPlugin = require("./ExternalsPlugin");
|
|
177
|
+
|
|
149
178
|
new ExternalsPlugin("module", ({ request, dependencyType }, callback) => {
|
|
150
179
|
if (dependencyType === "url") {
|
|
151
|
-
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request)))
|
|
180
|
+
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
|
|
152
181
|
return callback(null, `asset ${request}`);
|
|
182
|
+
}
|
|
153
183
|
} else if (options.experiments.css && dependencyType === "css-import") {
|
|
154
|
-
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request)))
|
|
184
|
+
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
|
|
155
185
|
return callback(null, `css-import ${request}`);
|
|
186
|
+
}
|
|
156
187
|
} else if (
|
|
157
188
|
/^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request))
|
|
158
189
|
) {
|
|
159
190
|
if (
|
|
160
191
|
options.experiments.css &&
|
|
161
192
|
/^\.css((\?)|$)/.test(/** @type {string} */ (request))
|
|
162
|
-
)
|
|
193
|
+
) {
|
|
163
194
|
return callback(null, `css-import ${request}`);
|
|
195
|
+
}
|
|
164
196
|
return callback(null, `module ${request}`);
|
|
165
197
|
}
|
|
166
198
|
callback();
|
|
@@ -168,18 +200,22 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
168
200
|
} else if (options.externalsPresets.node && options.experiments.css) {
|
|
169
201
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
170
202
|
const ExternalsPlugin = require("./ExternalsPlugin");
|
|
203
|
+
|
|
171
204
|
new ExternalsPlugin("module", ({ request, dependencyType }, callback) => {
|
|
172
205
|
if (dependencyType === "url") {
|
|
173
|
-
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request)))
|
|
206
|
+
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
|
|
174
207
|
return callback(null, `asset ${request}`);
|
|
208
|
+
}
|
|
175
209
|
} else if (dependencyType === "css-import") {
|
|
176
|
-
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request)))
|
|
210
|
+
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
|
|
177
211
|
return callback(null, `css-import ${request}`);
|
|
212
|
+
}
|
|
178
213
|
} else if (
|
|
179
214
|
/^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request))
|
|
180
215
|
) {
|
|
181
|
-
if (/^\.css(\?|$)/.test(/** @type {string} */ (request)))
|
|
216
|
+
if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) {
|
|
182
217
|
return callback(null, `css-import ${request}`);
|
|
218
|
+
}
|
|
183
219
|
return callback(null, `module ${request}`);
|
|
184
220
|
}
|
|
185
221
|
callback();
|
|
@@ -192,16 +228,19 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
192
228
|
switch (options.output.chunkFormat) {
|
|
193
229
|
case "array-push": {
|
|
194
230
|
const ArrayPushCallbackChunkFormatPlugin = require("./javascript/ArrayPushCallbackChunkFormatPlugin");
|
|
231
|
+
|
|
195
232
|
new ArrayPushCallbackChunkFormatPlugin().apply(compiler);
|
|
196
233
|
break;
|
|
197
234
|
}
|
|
198
235
|
case "commonjs": {
|
|
199
236
|
const CommonJsChunkFormatPlugin = require("./javascript/CommonJsChunkFormatPlugin");
|
|
237
|
+
|
|
200
238
|
new CommonJsChunkFormatPlugin().apply(compiler);
|
|
201
239
|
break;
|
|
202
240
|
}
|
|
203
241
|
case "module": {
|
|
204
242
|
const ModuleChunkFormatPlugin = require("./esm/ModuleChunkFormatPlugin");
|
|
243
|
+
|
|
205
244
|
new ModuleChunkFormatPlugin().apply(compiler);
|
|
206
245
|
break;
|
|
207
246
|
}
|
|
@@ -219,6 +258,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
219
258
|
if (enabledChunkLoadingTypes.length > 0) {
|
|
220
259
|
for (const type of enabledChunkLoadingTypes) {
|
|
221
260
|
const EnableChunkLoadingPlugin = require("./javascript/EnableChunkLoadingPlugin");
|
|
261
|
+
|
|
222
262
|
new EnableChunkLoadingPlugin(type).apply(compiler);
|
|
223
263
|
}
|
|
224
264
|
}
|
|
@@ -230,6 +270,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
230
270
|
if (enabledWasmLoadingTypes.length > 0) {
|
|
231
271
|
for (const type of enabledWasmLoadingTypes) {
|
|
232
272
|
const EnableWasmLoadingPlugin = require("./wasm/EnableWasmLoadingPlugin");
|
|
273
|
+
|
|
233
274
|
new EnableWasmLoadingPlugin(type).apply(compiler);
|
|
234
275
|
}
|
|
235
276
|
}
|
|
@@ -242,6 +283,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
242
283
|
let once = true;
|
|
243
284
|
for (const type of enabledLibraryTypes) {
|
|
244
285
|
const EnableLibraryPlugin = require("./library/EnableLibraryPlugin");
|
|
286
|
+
|
|
245
287
|
new EnableLibraryPlugin(type, {
|
|
246
288
|
// eslint-disable-next-line no-loop-func
|
|
247
289
|
additionalApply: () => {
|
|
@@ -262,6 +304,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
262
304
|
|
|
263
305
|
if (options.output.pathinfo) {
|
|
264
306
|
const ModuleInfoHeaderPlugin = require("./ModuleInfoHeaderPlugin");
|
|
307
|
+
|
|
265
308
|
new ModuleInfoHeaderPlugin(options.output.pathinfo !== true).apply(
|
|
266
309
|
compiler
|
|
267
310
|
);
|
|
@@ -269,6 +312,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
269
312
|
|
|
270
313
|
if (options.output.clean) {
|
|
271
314
|
const CleanPlugin = require("./CleanPlugin");
|
|
315
|
+
|
|
272
316
|
new CleanPlugin(
|
|
273
317
|
options.output.clean === true ? {} : options.output.clean
|
|
274
318
|
).apply(compiler);
|
|
@@ -300,6 +344,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
300
344
|
}).apply(compiler);
|
|
301
345
|
} else if (options.devtool.includes("eval")) {
|
|
302
346
|
const EvalDevToolModulePlugin = require("./EvalDevToolModulePlugin");
|
|
347
|
+
|
|
303
348
|
new EvalDevToolModulePlugin({
|
|
304
349
|
moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
|
|
305
350
|
namespace: options.output.devtoolNamespace
|
|
@@ -339,6 +384,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
339
384
|
|
|
340
385
|
if (options.experiments.syncWebAssembly) {
|
|
341
386
|
const WebAssemblyModulesPlugin = require("./wasm-sync/WebAssemblyModulesPlugin");
|
|
387
|
+
|
|
342
388
|
new WebAssemblyModulesPlugin({
|
|
343
389
|
mangleImports: options.optimization.mangleWasmImports
|
|
344
390
|
}).apply(compiler);
|
|
@@ -346,6 +392,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
346
392
|
|
|
347
393
|
if (options.experiments.asyncWebAssembly) {
|
|
348
394
|
const AsyncWebAssemblyModulesPlugin = require("./wasm-async/AsyncWebAssemblyModulesPlugin");
|
|
395
|
+
|
|
349
396
|
new AsyncWebAssemblyModulesPlugin({
|
|
350
397
|
mangleImports: options.optimization.mangleWasmImports
|
|
351
398
|
}).apply(compiler);
|
|
@@ -353,11 +400,13 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
353
400
|
|
|
354
401
|
if (options.experiments.css) {
|
|
355
402
|
const CssModulesPlugin = require("./css/CssModulesPlugin");
|
|
403
|
+
|
|
356
404
|
new CssModulesPlugin().apply(compiler);
|
|
357
405
|
}
|
|
358
406
|
|
|
359
407
|
if (options.experiments.lazyCompilation) {
|
|
360
408
|
const LazyCompilationPlugin = require("./hmr/LazyCompilationPlugin");
|
|
409
|
+
|
|
361
410
|
const lazyOptions =
|
|
362
411
|
typeof options.experiments.lazyCompilation === "object"
|
|
363
412
|
? options.experiments.lazyCompilation
|
|
@@ -384,6 +433,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
384
433
|
|
|
385
434
|
if (options.experiments.buildHttp) {
|
|
386
435
|
const HttpUriPlugin = require("./schemes/HttpUriPlugin");
|
|
436
|
+
|
|
387
437
|
const httpOptions = options.experiments.buildHttp;
|
|
388
438
|
new HttpUriPlugin(httpOptions).apply(compiler);
|
|
389
439
|
}
|
|
@@ -404,11 +454,13 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
404
454
|
|
|
405
455
|
new CompatibilityPlugin().apply(compiler);
|
|
406
456
|
new HarmonyModulesPlugin({
|
|
407
|
-
topLevelAwait: options.experiments.topLevelAwait
|
|
457
|
+
topLevelAwait: options.experiments.topLevelAwait,
|
|
458
|
+
deferImport: options.experiments.deferImport
|
|
408
459
|
}).apply(compiler);
|
|
409
460
|
if (options.amd !== false) {
|
|
410
461
|
const AMDPlugin = require("./dependencies/AMDPlugin");
|
|
411
462
|
const RequireJsStuffPlugin = require("./RequireJsStuffPlugin");
|
|
463
|
+
|
|
412
464
|
new AMDPlugin(options.amd || {}).apply(compiler);
|
|
413
465
|
new RequireJsStuffPlugin().apply(compiler);
|
|
414
466
|
}
|
|
@@ -416,6 +468,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
416
468
|
new LoaderPlugin().apply(compiler);
|
|
417
469
|
if (options.node !== false) {
|
|
418
470
|
const NodeStuffPlugin = require("./NodeStuffPlugin");
|
|
471
|
+
|
|
419
472
|
new NodeStuffPlugin(options.node).apply(compiler);
|
|
420
473
|
}
|
|
421
474
|
new APIPlugin({
|
|
@@ -448,29 +501,36 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
448
501
|
|
|
449
502
|
if (typeof options.mode !== "string") {
|
|
450
503
|
const WarnNoModeSetPlugin = require("./WarnNoModeSetPlugin");
|
|
504
|
+
|
|
451
505
|
new WarnNoModeSetPlugin().apply(compiler);
|
|
452
506
|
}
|
|
453
507
|
|
|
454
508
|
const EnsureChunkConditionsPlugin = require("./optimize/EnsureChunkConditionsPlugin");
|
|
509
|
+
|
|
455
510
|
new EnsureChunkConditionsPlugin().apply(compiler);
|
|
456
511
|
if (options.optimization.removeAvailableModules) {
|
|
457
512
|
const RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin");
|
|
513
|
+
|
|
458
514
|
new RemoveParentModulesPlugin().apply(compiler);
|
|
459
515
|
}
|
|
460
516
|
if (options.optimization.removeEmptyChunks) {
|
|
461
517
|
const RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin");
|
|
518
|
+
|
|
462
519
|
new RemoveEmptyChunksPlugin().apply(compiler);
|
|
463
520
|
}
|
|
464
521
|
if (options.optimization.mergeDuplicateChunks) {
|
|
465
522
|
const MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin");
|
|
523
|
+
|
|
466
524
|
new MergeDuplicateChunksPlugin().apply(compiler);
|
|
467
525
|
}
|
|
468
526
|
if (options.optimization.flagIncludedChunks) {
|
|
469
527
|
const FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin");
|
|
528
|
+
|
|
470
529
|
new FlagIncludedChunksPlugin().apply(compiler);
|
|
471
530
|
}
|
|
472
531
|
if (options.optimization.sideEffects) {
|
|
473
532
|
const SideEffectsFlagPlugin = require("./optimize/SideEffectsFlagPlugin");
|
|
533
|
+
|
|
474
534
|
new SideEffectsFlagPlugin(
|
|
475
535
|
options.optimization.sideEffects === true
|
|
476
536
|
).apply(compiler);
|
|
@@ -480,38 +540,46 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
480
540
|
}
|
|
481
541
|
if (options.optimization.usedExports) {
|
|
482
542
|
const FlagDependencyUsagePlugin = require("./FlagDependencyUsagePlugin");
|
|
543
|
+
|
|
483
544
|
new FlagDependencyUsagePlugin(
|
|
484
545
|
options.optimization.usedExports === "global"
|
|
485
546
|
).apply(compiler);
|
|
486
547
|
}
|
|
487
548
|
if (options.optimization.innerGraph) {
|
|
488
549
|
const InnerGraphPlugin = require("./optimize/InnerGraphPlugin");
|
|
550
|
+
|
|
489
551
|
new InnerGraphPlugin().apply(compiler);
|
|
490
552
|
}
|
|
491
553
|
if (options.optimization.mangleExports) {
|
|
492
554
|
const MangleExportsPlugin = require("./optimize/MangleExportsPlugin");
|
|
555
|
+
|
|
493
556
|
new MangleExportsPlugin(
|
|
494
557
|
options.optimization.mangleExports !== "size"
|
|
495
558
|
).apply(compiler);
|
|
496
559
|
}
|
|
497
560
|
if (options.optimization.concatenateModules) {
|
|
498
561
|
const ModuleConcatenationPlugin = require("./optimize/ModuleConcatenationPlugin");
|
|
562
|
+
|
|
499
563
|
new ModuleConcatenationPlugin().apply(compiler);
|
|
500
564
|
}
|
|
501
565
|
if (options.optimization.splitChunks) {
|
|
502
566
|
const SplitChunksPlugin = require("./optimize/SplitChunksPlugin");
|
|
567
|
+
|
|
503
568
|
new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler);
|
|
504
569
|
}
|
|
505
570
|
if (options.optimization.runtimeChunk) {
|
|
506
571
|
const RuntimeChunkPlugin = require("./optimize/RuntimeChunkPlugin");
|
|
572
|
+
|
|
507
573
|
new RuntimeChunkPlugin(options.optimization.runtimeChunk).apply(compiler);
|
|
508
574
|
}
|
|
509
575
|
if (!options.optimization.emitOnErrors) {
|
|
510
576
|
const NoEmitOnErrorsPlugin = require("./NoEmitOnErrorsPlugin");
|
|
577
|
+
|
|
511
578
|
new NoEmitOnErrorsPlugin().apply(compiler);
|
|
512
579
|
}
|
|
513
580
|
if (options.optimization.realContentHash) {
|
|
514
581
|
const RealContentHashPlugin = require("./optimize/RealContentHashPlugin");
|
|
582
|
+
|
|
515
583
|
new RealContentHashPlugin({
|
|
516
584
|
hashFunction:
|
|
517
585
|
/** @type {NonNullable<WebpackOptions["output"]["hashFunction"]>} */
|
|
@@ -523,6 +591,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
523
591
|
}
|
|
524
592
|
if (options.optimization.checkWasmTypes) {
|
|
525
593
|
const WasmFinalizeExportsPlugin = require("./wasm-sync/WasmFinalizeExportsPlugin");
|
|
594
|
+
|
|
526
595
|
new WasmFinalizeExportsPlugin().apply(compiler);
|
|
527
596
|
}
|
|
528
597
|
const moduleIds = options.optimization.moduleIds;
|
|
@@ -530,17 +599,20 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
530
599
|
switch (moduleIds) {
|
|
531
600
|
case "natural": {
|
|
532
601
|
const NaturalModuleIdsPlugin = require("./ids/NaturalModuleIdsPlugin");
|
|
602
|
+
|
|
533
603
|
new NaturalModuleIdsPlugin().apply(compiler);
|
|
534
604
|
break;
|
|
535
605
|
}
|
|
536
606
|
case "named": {
|
|
537
607
|
const NamedModuleIdsPlugin = require("./ids/NamedModuleIdsPlugin");
|
|
608
|
+
|
|
538
609
|
new NamedModuleIdsPlugin().apply(compiler);
|
|
539
610
|
break;
|
|
540
611
|
}
|
|
541
612
|
case "hashed": {
|
|
542
613
|
const WarnDeprecatedOptionPlugin = require("./WarnDeprecatedOptionPlugin");
|
|
543
614
|
const HashedModuleIdsPlugin = require("./ids/HashedModuleIdsPlugin");
|
|
615
|
+
|
|
544
616
|
new WarnDeprecatedOptionPlugin(
|
|
545
617
|
"optimization.moduleIds",
|
|
546
618
|
"hashed",
|
|
@@ -553,11 +625,13 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
553
625
|
}
|
|
554
626
|
case "deterministic": {
|
|
555
627
|
const DeterministicModuleIdsPlugin = require("./ids/DeterministicModuleIdsPlugin");
|
|
628
|
+
|
|
556
629
|
new DeterministicModuleIdsPlugin().apply(compiler);
|
|
557
630
|
break;
|
|
558
631
|
}
|
|
559
632
|
case "size": {
|
|
560
633
|
const OccurrenceModuleIdsPlugin = require("./ids/OccurrenceModuleIdsPlugin");
|
|
634
|
+
|
|
561
635
|
new OccurrenceModuleIdsPlugin({
|
|
562
636
|
prioritiseInitial: true
|
|
563
637
|
}).apply(compiler);
|
|
@@ -574,22 +648,26 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
574
648
|
switch (chunkIds) {
|
|
575
649
|
case "natural": {
|
|
576
650
|
const NaturalChunkIdsPlugin = require("./ids/NaturalChunkIdsPlugin");
|
|
651
|
+
|
|
577
652
|
new NaturalChunkIdsPlugin().apply(compiler);
|
|
578
653
|
break;
|
|
579
654
|
}
|
|
580
655
|
case "named": {
|
|
581
656
|
const NamedChunkIdsPlugin = require("./ids/NamedChunkIdsPlugin");
|
|
657
|
+
|
|
582
658
|
new NamedChunkIdsPlugin().apply(compiler);
|
|
583
659
|
break;
|
|
584
660
|
}
|
|
585
661
|
case "deterministic": {
|
|
586
662
|
const DeterministicChunkIdsPlugin = require("./ids/DeterministicChunkIdsPlugin");
|
|
663
|
+
|
|
587
664
|
new DeterministicChunkIdsPlugin().apply(compiler);
|
|
588
665
|
break;
|
|
589
666
|
}
|
|
590
667
|
case "size": {
|
|
591
668
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
592
669
|
const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin");
|
|
670
|
+
|
|
593
671
|
new OccurrenceChunkIdsPlugin({
|
|
594
672
|
prioritiseInitial: true
|
|
595
673
|
}).apply(compiler);
|
|
@@ -598,6 +676,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
598
676
|
case "total-size": {
|
|
599
677
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
600
678
|
const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin");
|
|
679
|
+
|
|
601
680
|
new OccurrenceChunkIdsPlugin({
|
|
602
681
|
prioritiseInitial: false
|
|
603
682
|
}).apply(compiler);
|
|
@@ -611,6 +690,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
611
690
|
}
|
|
612
691
|
if (options.optimization.nodeEnv) {
|
|
613
692
|
const DefinePlugin = require("./DefinePlugin");
|
|
693
|
+
|
|
614
694
|
new DefinePlugin({
|
|
615
695
|
"process.env.NODE_ENV": JSON.stringify(options.optimization.nodeEnv)
|
|
616
696
|
}).apply(compiler);
|
|
@@ -630,6 +710,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
630
710
|
|
|
631
711
|
if (options.performance) {
|
|
632
712
|
const SizeLimitsPlugin = require("./performance/SizeLimitsPlugin");
|
|
713
|
+
|
|
633
714
|
new SizeLimitsPlugin(options.performance).apply(compiler);
|
|
634
715
|
}
|
|
635
716
|
|
|
@@ -642,6 +723,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
642
723
|
new WarnCaseSensitiveModulesPlugin().apply(compiler);
|
|
643
724
|
|
|
644
725
|
const AddManagedPathsPlugin = require("./cache/AddManagedPathsPlugin");
|
|
726
|
+
|
|
645
727
|
new AddManagedPathsPlugin(
|
|
646
728
|
/** @type {NonNullable<WebpackOptions["snapshot"]["managedPaths"]>} */
|
|
647
729
|
(options.snapshot.managedPaths),
|
|
@@ -658,6 +740,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
658
740
|
if (Number.isFinite(cacheOptions.maxGenerations)) {
|
|
659
741
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
660
742
|
const MemoryWithGcCachePlugin = require("./cache/MemoryWithGcCachePlugin");
|
|
743
|
+
|
|
661
744
|
new MemoryWithGcCachePlugin({
|
|
662
745
|
maxGenerations:
|
|
663
746
|
/** @type {number} */
|
|
@@ -666,6 +749,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
666
749
|
} else {
|
|
667
750
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
668
751
|
const MemoryCachePlugin = require("./cache/MemoryCachePlugin");
|
|
752
|
+
|
|
669
753
|
new MemoryCachePlugin().apply(compiler);
|
|
670
754
|
}
|
|
671
755
|
if (cacheOptions.cacheUnaffected) {
|
|
@@ -680,7 +764,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
680
764
|
}
|
|
681
765
|
case "filesystem": {
|
|
682
766
|
const AddBuildDependenciesPlugin = require("./cache/AddBuildDependenciesPlugin");
|
|
683
|
-
|
|
767
|
+
|
|
684
768
|
for (const key in cacheOptions.buildDependencies) {
|
|
685
769
|
const list = cacheOptions.buildDependencies[key];
|
|
686
770
|
new AddBuildDependenciesPlugin(list).apply(compiler);
|
|
@@ -688,10 +772,12 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
688
772
|
if (!Number.isFinite(cacheOptions.maxMemoryGenerations)) {
|
|
689
773
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
690
774
|
const MemoryCachePlugin = require("./cache/MemoryCachePlugin");
|
|
775
|
+
|
|
691
776
|
new MemoryCachePlugin().apply(compiler);
|
|
692
777
|
} else if (cacheOptions.maxMemoryGenerations !== 0) {
|
|
693
778
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
|
694
779
|
const MemoryWithGcCachePlugin = require("./cache/MemoryWithGcCachePlugin");
|
|
780
|
+
|
|
695
781
|
new MemoryWithGcCachePlugin({
|
|
696
782
|
maxGenerations:
|
|
697
783
|
/** @type {number} */
|
|
@@ -710,6 +796,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
710
796
|
case "pack": {
|
|
711
797
|
const IdleFileCachePlugin = require("./cache/IdleFileCachePlugin");
|
|
712
798
|
const PackFileCacheStrategy = require("./cache/PackFileCacheStrategy");
|
|
799
|
+
|
|
713
800
|
new IdleFileCachePlugin(
|
|
714
801
|
new PackFileCacheStrategy({
|
|
715
802
|
compiler,
|
|
@@ -754,6 +841,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
|
754
841
|
|
|
755
842
|
if (options.ignoreWarnings && options.ignoreWarnings.length > 0) {
|
|
756
843
|
const IgnoreWarningsPlugin = require("./IgnoreWarningsPlugin");
|
|
844
|
+
|
|
757
845
|
new IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler);
|
|
758
846
|
}
|
|
759
847
|
|