webpack 5.96.0 → 5.97.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/lib/CssModule.js +5 -0
- package/lib/DependencyTemplate.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -0
- package/lib/FalseIIFEUmdWarning.js +19 -0
- package/lib/HotModuleReplacementPlugin.js +4 -0
- package/lib/Module.js +6 -0
- package/lib/ModuleSourceTypesConstants.js +12 -0
- package/lib/NormalModule.js +1 -0
- package/lib/RuntimeTemplate.js +7 -0
- package/lib/SourceMapDevToolPlugin.js +8 -0
- package/lib/WebpackOptionsApply.js +3 -1
- package/lib/asset/AssetModulesPlugin.js +7 -2
- package/lib/config/defaults.js +52 -36
- package/lib/config/normalization.js +0 -1
- package/lib/config/target.js +8 -8
- package/lib/css/CssGenerator.js +139 -35
- package/lib/css/CssLoadingRuntimeModule.js +108 -198
- package/lib/css/CssModulesPlugin.js +78 -124
- package/lib/css/CssParser.js +545 -121
- package/lib/css/walkCssTokens.js +41 -19
- package/lib/dependencies/CachedConstDependency.js +2 -1
- package/lib/dependencies/ContextDependencyTemplateAsId.js +3 -2
- package/lib/dependencies/{CssExportDependency.js → CssIcssExportDependency.js} +35 -35
- package/lib/dependencies/CssIcssImportDependency.js +118 -0
- package/lib/dependencies/CssIcssSymbolDependency.js +132 -0
- package/lib/dependencies/CssImportDependency.js +0 -8
- package/lib/dependencies/CssLocalIdentifierDependency.js +69 -73
- package/lib/dependencies/CssUrlDependency.js +1 -0
- package/lib/esm/ModuleChunkFormatPlugin.js +8 -4
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +17 -10
- package/lib/index.js +13 -6
- package/lib/javascript/EnableChunkLoadingPlugin.js +2 -4
- package/lib/library/AssignLibraryPlugin.js +1 -1
- package/lib/library/EnableLibraryPlugin.js +17 -0
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +81 -78
- package/lib/node/ReadFileCompileWasmPlugin.js +76 -57
- package/lib/optimize/MergeDuplicateChunksPlugin.js +22 -2
- package/lib/sharing/ConsumeSharedPlugin.js +35 -12
- package/lib/sharing/utils.js +35 -4
- package/lib/stats/DefaultStatsFactoryPlugin.js +0 -5
- package/lib/util/Queue.js +52 -24
- package/lib/util/generateDebugId.js +33 -0
- package/lib/util/internalSerializables.js +6 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +36 -25
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +26 -2
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +103 -0
- package/lib/wasm-sync/WebAssemblyParser.js +1 -1
- package/lib/web/FetchCompileAsyncWasmPlugin.js +43 -44
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/package.json +5 -5
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +34 -12
- package/schemas/plugins/BannerPlugin.json +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssParserOptions.check.js +1 -1
- package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.d.ts +7 -0
- package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +6 -0
- package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.json +11 -0
- package/types.d.ts +85 -24
- package/lib/css/CssExportsGenerator.js +0 -207
package/lib/CssModule.js
CHANGED
@@ -65,6 +65,11 @@ class CssModule extends NormalModule {
|
|
65
65
|
identifier += `|${inheritance.join("|")}`;
|
66
66
|
}
|
67
67
|
|
68
|
+
// We generate extra code for HMR, so we need to invalidate the module
|
69
|
+
if (this.hot) {
|
70
|
+
identifier += `|${this.hot}`;
|
71
|
+
}
|
72
|
+
|
68
73
|
return identifier;
|
69
74
|
}
|
70
75
|
|
@@ -40,11 +40,11 @@
|
|
40
40
|
|
41
41
|
/**
|
42
42
|
* @typedef {object} CssDependencyTemplateContextExtras
|
43
|
-
* @property {
|
43
|
+
* @property {CssData} cssData the css exports data
|
44
44
|
*/
|
45
45
|
|
46
46
|
/**
|
47
|
-
* @typedef {object}
|
47
|
+
* @typedef {object} CssData
|
48
48
|
* @property {boolean} esModule whether export __esModule
|
49
49
|
* @property {Map<string, string>} exports the css exports
|
50
50
|
*/
|
@@ -12,6 +12,7 @@ const RuntimeGlobals = require("./RuntimeGlobals");
|
|
12
12
|
const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin");
|
13
13
|
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
14
14
|
const ConcatenatedModule = require("./optimize/ConcatenatedModule");
|
15
|
+
const generateDebugId = require("./util/generateDebugId");
|
15
16
|
const { makePathsAbsolute } = require("./util/identifier");
|
16
17
|
|
17
18
|
/** @typedef {import("webpack-sources").Source} Source */
|
@@ -173,6 +174,10 @@ class EvalSourceMapDevToolPlugin {
|
|
173
174
|
sourceMap.file =
|
174
175
|
typeof moduleId === "number" ? `${moduleId}.js` : moduleId;
|
175
176
|
|
177
|
+
if (options.debugIds) {
|
178
|
+
sourceMap.debugId = generateDebugId(content, sourceMap.file);
|
179
|
+
}
|
180
|
+
|
176
181
|
const footer = `${this.sourceMapComment.replace(
|
177
182
|
/\[url\]/g,
|
178
183
|
`data:application/json;charset=utf-8;base64,${Buffer.from(
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Arka Pratim Chaudhuri @arkapratimc
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const WebpackError = require("./WebpackError");
|
9
|
+
|
10
|
+
class FalseIIFEUmdWarning extends WebpackError {
|
11
|
+
constructor() {
|
12
|
+
super();
|
13
|
+
this.name = "FalseIIFEUmdWarning";
|
14
|
+
this.message =
|
15
|
+
"Configuration:\nSetting 'output.iife' to 'false' is incompatible with 'output.library.type' set to 'umd'. This configuration may cause unexpected behavior, as UMD libraries are expected to use an IIFE (Immediately Invoked Function Expression) to support various module formats. Consider setting 'output.iife' to 'true' or choosing a different 'library.type' to ensure compatibility.\nLearn more: https://webpack.js.org/configuration/output/";
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
module.exports = FalseIIFEUmdWarning;
|
@@ -856,6 +856,10 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
|
|
856
856
|
.tap(PLUGIN_NAME, parser => {
|
857
857
|
applyImportMetaHot(parser);
|
858
858
|
});
|
859
|
+
normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => {
|
860
|
+
module.hot = true;
|
861
|
+
return module;
|
862
|
+
});
|
859
863
|
|
860
864
|
NormalModule.getCompilationHooks(compilation).loader.tap(
|
861
865
|
PLUGIN_NAME,
|
package/lib/Module.js
CHANGED
@@ -106,6 +106,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
106
106
|
* @property {boolean=} strictHarmonyModule
|
107
107
|
* @property {boolean=} async
|
108
108
|
* @property {boolean=} sideEffectFree
|
109
|
+
* @property {Record<string, string>=} exportsFinalName
|
109
110
|
*/
|
110
111
|
|
111
112
|
/**
|
@@ -199,6 +200,9 @@ class Module extends DependenciesBlock {
|
|
199
200
|
/** @type {boolean} */
|
200
201
|
this.useSimpleSourceMap = false;
|
201
202
|
|
203
|
+
// Is in hot context, i.e. HotModuleReplacementPlugin.js enabled
|
204
|
+
/** @type {boolean} */
|
205
|
+
this.hot = false;
|
202
206
|
// Info from Build
|
203
207
|
/** @type {WebpackError[] | undefined} */
|
204
208
|
this._warnings = undefined;
|
@@ -1074,6 +1078,7 @@ class Module extends DependenciesBlock {
|
|
1074
1078
|
write(this.factoryMeta);
|
1075
1079
|
write(this.useSourceMap);
|
1076
1080
|
write(this.useSimpleSourceMap);
|
1081
|
+
write(this.hot);
|
1077
1082
|
write(
|
1078
1083
|
this._warnings !== undefined && this._warnings.length === 0
|
1079
1084
|
? undefined
|
@@ -1103,6 +1108,7 @@ class Module extends DependenciesBlock {
|
|
1103
1108
|
this.factoryMeta = read();
|
1104
1109
|
this.useSourceMap = read();
|
1105
1110
|
this.useSimpleSourceMap = read();
|
1111
|
+
this.hot = read();
|
1106
1112
|
this._warnings = read();
|
1107
1113
|
this._errors = read();
|
1108
1114
|
this.buildMeta = read();
|
@@ -39,11 +39,21 @@ const ASSET_AND_JS_AND_CSS_URL_TYPES = new Set([
|
|
39
39
|
*/
|
40
40
|
const JS_TYPES = new Set(["javascript"]);
|
41
41
|
|
42
|
+
/**
|
43
|
+
* @type {ReadonlySet<"javascript" | "css-export">}
|
44
|
+
*/
|
45
|
+
const JS_AND_CSS_EXPORT_TYPES = new Set(["javascript", "css-export"]);
|
46
|
+
|
42
47
|
/**
|
43
48
|
* @type {ReadonlySet<"javascript" | "css-url">}
|
44
49
|
*/
|
45
50
|
const JS_AND_CSS_URL_TYPES = new Set(["javascript", "css-url"]);
|
46
51
|
|
52
|
+
/**
|
53
|
+
* @type {ReadonlySet<"javascript" | "css">}
|
54
|
+
*/
|
55
|
+
const JS_AND_CSS_TYPES = new Set(["javascript", "css"]);
|
56
|
+
|
47
57
|
/**
|
48
58
|
* @type {ReadonlySet<"css">}
|
49
59
|
*/
|
@@ -85,7 +95,9 @@ const SHARED_INIT_TYPES = new Set(["share-init"]);
|
|
85
95
|
|
86
96
|
module.exports.NO_TYPES = NO_TYPES;
|
87
97
|
module.exports.JS_TYPES = JS_TYPES;
|
98
|
+
module.exports.JS_AND_CSS_TYPES = JS_AND_CSS_TYPES;
|
88
99
|
module.exports.JS_AND_CSS_URL_TYPES = JS_AND_CSS_URL_TYPES;
|
100
|
+
module.exports.JS_AND_CSS_EXPORT_TYPES = JS_AND_CSS_EXPORT_TYPES;
|
89
101
|
module.exports.ASSET_TYPES = ASSET_TYPES;
|
90
102
|
module.exports.ASSET_AND_JS_TYPES = ASSET_AND_JS_TYPES;
|
91
103
|
module.exports.ASSET_AND_CSS_URL_TYPES = ASSET_AND_CSS_URL_TYPES;
|
package/lib/NormalModule.js
CHANGED
@@ -113,6 +113,7 @@ const memoize = require("./util/memoize");
|
|
113
113
|
* @property {string=} sourceRoot
|
114
114
|
* @property {string[]=} sourcesContent
|
115
115
|
* @property {string[]=} names
|
116
|
+
* @property {string=} debugId
|
116
117
|
*/
|
117
118
|
|
118
119
|
const getInvalidDependenciesModuleWarning = memoize(() =>
|
package/lib/RuntimeTemplate.js
CHANGED
@@ -105,6 +105,13 @@ class RuntimeTemplate {
|
|
105
105
|
return this.outputOptions.module;
|
106
106
|
}
|
107
107
|
|
108
|
+
isNeutralPlatform() {
|
109
|
+
return (
|
110
|
+
!this.outputOptions.environment.document &&
|
111
|
+
!this.compilation.compiler.platform.node
|
112
|
+
);
|
113
|
+
}
|
114
|
+
|
108
115
|
supportsConst() {
|
109
116
|
return this.outputOptions.environment.const;
|
110
117
|
}
|
@@ -14,6 +14,7 @@ const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOpt
|
|
14
14
|
const createSchemaValidation = require("./util/create-schema-validation");
|
15
15
|
const createHash = require("./util/createHash");
|
16
16
|
const { relative, dirname } = require("./util/fs");
|
17
|
+
const generateDebugId = require("./util/generateDebugId");
|
17
18
|
const { makePathsAbsolute } = require("./util/identifier");
|
18
19
|
|
19
20
|
/** @typedef {import("webpack-sources").MapOptions} MapOptions */
|
@@ -479,6 +480,13 @@ class SourceMapDevToolPlugin {
|
|
479
480
|
"\n/*$1*/"
|
480
481
|
);
|
481
482
|
}
|
483
|
+
|
484
|
+
if (options.debugIds) {
|
485
|
+
const debugId = generateDebugId(source, sourceMap.file);
|
486
|
+
sourceMap.debugId = debugId;
|
487
|
+
currentSourceMappingURLComment = `\n//# debugId=${debugId}${currentSourceMappingURLComment}`;
|
488
|
+
}
|
489
|
+
|
482
490
|
const sourceMapString = JSON.stringify(sourceMap);
|
483
491
|
if (sourceMapFilename) {
|
484
492
|
const filename = file;
|
@@ -264,6 +264,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
264
264
|
const cheap = options.devtool.includes("cheap");
|
265
265
|
const moduleMaps = options.devtool.includes("module");
|
266
266
|
const noSources = options.devtool.includes("nosources");
|
267
|
+
const debugIds = options.devtool.includes("debugids");
|
267
268
|
const Plugin = evalWrapped
|
268
269
|
? require("./EvalSourceMapDevToolPlugin")
|
269
270
|
: require("./SourceMapDevToolPlugin");
|
@@ -276,7 +277,8 @@ class WebpackOptionsApply extends OptionsApply {
|
|
276
277
|
module: moduleMaps ? true : !cheap,
|
277
278
|
columns: !cheap,
|
278
279
|
noSources,
|
279
|
-
namespace: options.output.devtoolNamespace
|
280
|
+
namespace: options.output.devtoolNamespace,
|
281
|
+
debugIds
|
280
282
|
}).apply(compiler);
|
281
283
|
} else if (options.devtool.includes("eval")) {
|
282
284
|
const EvalDevToolModulePlugin = require("./EvalDevToolModulePlugin");
|
@@ -202,14 +202,19 @@ class AssetModulesPlugin {
|
|
202
202
|
const data =
|
203
203
|
/** @type {NonNullable<CodeGenerationResult["data"]>} */
|
204
204
|
(codeGenResult.data);
|
205
|
+
const errored = module.getNumberOfErrors() > 0;
|
205
206
|
result.push({
|
206
207
|
render: () =>
|
207
208
|
/** @type {Source} */ (codeGenResult.sources.get(type)),
|
208
|
-
filename:
|
209
|
+
filename: errored
|
210
|
+
? module.nameForCondition()
|
211
|
+
: buildInfo.filename || data.get("filename"),
|
209
212
|
info: buildInfo.assetInfo || data.get("assetInfo"),
|
210
213
|
auxiliary: true,
|
211
214
|
identifier: `assetModule${chunkGraph.getModuleId(module)}`,
|
212
|
-
hash:
|
215
|
+
hash: errored
|
216
|
+
? chunkGraph.getModuleHash(module, chunk.runtime)
|
217
|
+
: buildInfo.fullContentHash || data.get("fullContentHash")
|
213
218
|
});
|
214
219
|
} catch (err) {
|
215
220
|
/** @type {Error} */ (err).message +=
|
package/lib/config/defaults.js
CHANGED
@@ -229,6 +229,25 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => {
|
|
229
229
|
futureDefaults
|
230
230
|
});
|
231
231
|
|
232
|
+
applyOutputDefaults(options.output, {
|
233
|
+
context: /** @type {Context} */ (options.context),
|
234
|
+
targetProperties,
|
235
|
+
isAffectedByBrowserslist:
|
236
|
+
target === undefined ||
|
237
|
+
(typeof target === "string" && target.startsWith("browserslist")) ||
|
238
|
+
(Array.isArray(target) &&
|
239
|
+
target.some(target => target.startsWith("browserslist"))),
|
240
|
+
outputModule:
|
241
|
+
/** @type {NonNullable<ExperimentsNormalized["outputModule"]>} */
|
242
|
+
(options.experiments.outputModule),
|
243
|
+
development,
|
244
|
+
entry: options.entry,
|
245
|
+
futureDefaults,
|
246
|
+
asyncWebAssembly:
|
247
|
+
/** @type {NonNullable<ExperimentsNormalized["asyncWebAssembly"]>} */
|
248
|
+
(options.experiments.asyncWebAssembly)
|
249
|
+
});
|
250
|
+
|
232
251
|
applyModuleDefaults(options.module, {
|
233
252
|
cache,
|
234
253
|
syncWebAssembly:
|
@@ -242,25 +261,10 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => {
|
|
242
261
|
(options.experiments.css),
|
243
262
|
futureDefaults,
|
244
263
|
isNode: targetProperties && targetProperties.node === true,
|
264
|
+
uniqueName: options.output.uniqueName,
|
245
265
|
targetProperties
|
246
266
|
});
|
247
267
|
|
248
|
-
applyOutputDefaults(options.output, {
|
249
|
-
context: /** @type {Context} */ (options.context),
|
250
|
-
targetProperties,
|
251
|
-
isAffectedByBrowserslist:
|
252
|
-
target === undefined ||
|
253
|
-
(typeof target === "string" && target.startsWith("browserslist")) ||
|
254
|
-
(Array.isArray(target) &&
|
255
|
-
target.some(target => target.startsWith("browserslist"))),
|
256
|
-
outputModule:
|
257
|
-
/** @type {NonNullable<ExperimentsNormalized["outputModule"]>} */
|
258
|
-
(options.experiments.outputModule),
|
259
|
-
development,
|
260
|
-
entry: options.entry,
|
261
|
-
futureDefaults
|
262
|
-
});
|
263
|
-
|
264
268
|
applyExternalsPresetsDefaults(options.externalsPresets, {
|
265
269
|
targetProperties,
|
266
270
|
buildHttp: Boolean(options.experiments.buildHttp)
|
@@ -589,7 +593,7 @@ const applyCssGeneratorOptionsDefaults = (
|
|
589
593
|
D(
|
590
594
|
generatorOptions,
|
591
595
|
"exportsOnly",
|
592
|
-
!targetProperties ||
|
596
|
+
!targetProperties || targetProperties.document === false
|
593
597
|
);
|
594
598
|
D(generatorOptions, "esModule", true);
|
595
599
|
};
|
@@ -602,6 +606,7 @@ const applyCssGeneratorOptionsDefaults = (
|
|
602
606
|
* @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled
|
603
607
|
* @param {boolean} options.css is css enabled
|
604
608
|
* @param {boolean} options.futureDefaults is future defaults enabled
|
609
|
+
* @param {string} options.uniqueName the unique name
|
605
610
|
* @param {boolean} options.isNode is node target platform
|
606
611
|
* @param {TargetProperties | false} options.targetProperties target properties
|
607
612
|
* @returns {void}
|
@@ -615,6 +620,7 @@ const applyModuleDefaults = (
|
|
615
620
|
css,
|
616
621
|
futureDefaults,
|
617
622
|
isNode,
|
623
|
+
uniqueName,
|
618
624
|
targetProperties
|
619
625
|
}
|
620
626
|
) => {
|
@@ -670,6 +676,8 @@ const applyModuleDefaults = (
|
|
670
676
|
if (css) {
|
671
677
|
F(module.parser, CSS_MODULE_TYPE, () => ({}));
|
672
678
|
|
679
|
+
D(module.parser[CSS_MODULE_TYPE], "import", true);
|
680
|
+
D(module.parser[CSS_MODULE_TYPE], "url", true);
|
673
681
|
D(module.parser[CSS_MODULE_TYPE], "namedExports", true);
|
674
682
|
|
675
683
|
F(module.generator, CSS_MODULE_TYPE, () => ({}));
|
@@ -680,19 +688,18 @@ const applyModuleDefaults = (
|
|
680
688
|
{ targetProperties }
|
681
689
|
);
|
682
690
|
|
691
|
+
const localIdentName =
|
692
|
+
uniqueName.length > 0 ? "[uniqueName]-[id]-[local]" : "[id]-[local]";
|
693
|
+
|
683
694
|
F(module.generator, CSS_MODULE_TYPE_AUTO, () => ({}));
|
684
|
-
D(
|
685
|
-
module.generator[CSS_MODULE_TYPE_AUTO],
|
686
|
-
"localIdentName",
|
687
|
-
"[uniqueName]-[id]-[local]"
|
688
|
-
);
|
695
|
+
D(module.generator[CSS_MODULE_TYPE_AUTO], "localIdentName", localIdentName);
|
689
696
|
D(module.generator[CSS_MODULE_TYPE_AUTO], "exportsConvention", "as-is");
|
690
697
|
|
691
698
|
F(module.generator, CSS_MODULE_TYPE_MODULE, () => ({}));
|
692
699
|
D(
|
693
700
|
module.generator[CSS_MODULE_TYPE_MODULE],
|
694
701
|
"localIdentName",
|
695
|
-
|
702
|
+
localIdentName
|
696
703
|
);
|
697
704
|
D(module.generator[CSS_MODULE_TYPE_MODULE], "exportsConvention", "as-is");
|
698
705
|
|
@@ -700,7 +707,7 @@ const applyModuleDefaults = (
|
|
700
707
|
D(
|
701
708
|
module.generator[CSS_MODULE_TYPE_GLOBAL],
|
702
709
|
"localIdentName",
|
703
|
-
|
710
|
+
localIdentName
|
704
711
|
);
|
705
712
|
D(module.generator[CSS_MODULE_TYPE_GLOBAL], "exportsConvention", "as-is");
|
706
713
|
}
|
@@ -864,6 +871,7 @@ const applyModuleDefaults = (
|
|
864
871
|
* @param {boolean} options.development is development mode
|
865
872
|
* @param {Entry} options.entry entry option
|
866
873
|
* @param {boolean} options.futureDefaults is future defaults enabled
|
874
|
+
* @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled
|
867
875
|
* @returns {void}
|
868
876
|
*/
|
869
877
|
const applyOutputDefaults = (
|
@@ -875,7 +883,8 @@ const applyOutputDefaults = (
|
|
875
883
|
outputModule,
|
876
884
|
development,
|
877
885
|
entry,
|
878
|
-
futureDefaults
|
886
|
+
futureDefaults,
|
887
|
+
asyncWebAssembly
|
879
888
|
}
|
880
889
|
) => {
|
881
890
|
/**
|
@@ -1063,7 +1072,6 @@ const applyOutputDefaults = (
|
|
1063
1072
|
}
|
1064
1073
|
return "[id].css";
|
1065
1074
|
});
|
1066
|
-
D(output, "cssHeadDataCompression", !development);
|
1067
1075
|
D(output, "assetModuleFilename", "[hash][ext][query]");
|
1068
1076
|
D(output, "webassemblyModuleFilename", "[hash].module.wasm");
|
1069
1077
|
D(output, "compareBeforeEmit", true);
|
@@ -1130,10 +1138,12 @@ const applyOutputDefaults = (
|
|
1130
1138
|
break;
|
1131
1139
|
}
|
1132
1140
|
if (
|
1133
|
-
tp.require === null ||
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1141
|
+
(tp.require === null ||
|
1142
|
+
tp.nodeBuiltins === null ||
|
1143
|
+
tp.document === null ||
|
1144
|
+
tp.importScripts === null) &&
|
1145
|
+
output.module &&
|
1146
|
+
environment.dynamicImport
|
1137
1147
|
) {
|
1138
1148
|
return "universal";
|
1139
1149
|
}
|
@@ -1155,9 +1165,11 @@ const applyOutputDefaults = (
|
|
1155
1165
|
break;
|
1156
1166
|
}
|
1157
1167
|
if (
|
1158
|
-
tp.require === null ||
|
1159
|
-
|
1160
|
-
|
1168
|
+
(tp.require === null ||
|
1169
|
+
tp.nodeBuiltins === null ||
|
1170
|
+
tp.importScriptsInWorker === null) &&
|
1171
|
+
output.module &&
|
1172
|
+
environment.dynamicImport
|
1161
1173
|
) {
|
1162
1174
|
return "universal";
|
1163
1175
|
}
|
@@ -1167,9 +1179,13 @@ const applyOutputDefaults = (
|
|
1167
1179
|
F(output, "wasmLoading", () => {
|
1168
1180
|
if (tp) {
|
1169
1181
|
if (tp.fetchWasm) return "fetch";
|
1170
|
-
if (tp.nodeBuiltins)
|
1171
|
-
|
1172
|
-
|
1182
|
+
if (tp.nodeBuiltins) return "async-node";
|
1183
|
+
if (
|
1184
|
+
(tp.nodeBuiltins === null || tp.fetchWasm === null) &&
|
1185
|
+
asyncWebAssembly &&
|
1186
|
+
output.module &&
|
1187
|
+
environment.dynamicImport
|
1188
|
+
) {
|
1173
1189
|
return "universal";
|
1174
1190
|
}
|
1175
1191
|
}
|
@@ -315,7 +315,6 @@ const getNormalizedWebpackOptions = config => ({
|
|
315
315
|
chunkLoadTimeout: output.chunkLoadTimeout,
|
316
316
|
cssFilename: output.cssFilename,
|
317
317
|
cssChunkFilename: output.cssChunkFilename,
|
318
|
-
cssHeadDataCompression: output.cssHeadDataCompression,
|
319
318
|
clean: output.clean,
|
320
319
|
compareBeforeEmit: output.compareBeforeEmit,
|
321
320
|
crossOriginLoading: output.crossOriginLoading,
|
package/lib/config/target.js
CHANGED
@@ -122,10 +122,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
122
122
|
"Web browser.",
|
123
123
|
/^web$/,
|
124
124
|
() => ({
|
125
|
+
node: false,
|
125
126
|
web: true,
|
126
|
-
browser: true,
|
127
127
|
webworker: null,
|
128
|
-
|
128
|
+
browser: true,
|
129
129
|
electron: false,
|
130
130
|
nwjs: false,
|
131
131
|
|
@@ -143,10 +143,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
143
143
|
"Web Worker, SharedWorker or Service Worker.",
|
144
144
|
/^webworker$/,
|
145
145
|
() => ({
|
146
|
+
node: false,
|
146
147
|
web: true,
|
147
|
-
browser: true,
|
148
148
|
webworker: true,
|
149
|
-
|
149
|
+
browser: true,
|
150
150
|
electron: false,
|
151
151
|
nwjs: false,
|
152
152
|
|
@@ -168,11 +168,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
168
168
|
// see https://node.green/
|
169
169
|
return {
|
170
170
|
node: true,
|
171
|
-
electron: false,
|
172
|
-
nwjs: false,
|
173
171
|
web: false,
|
174
172
|
webworker: false,
|
175
173
|
browser: false,
|
174
|
+
electron: false,
|
175
|
+
nwjs: false,
|
176
176
|
|
177
177
|
require: !asyncFlag,
|
178
178
|
nodeBuiltins: true,
|
@@ -208,10 +208,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
208
208
|
// see https://node.green/ + https://github.com/electron/releases
|
209
209
|
return {
|
210
210
|
node: true,
|
211
|
-
electron: true,
|
212
211
|
web: context !== "main",
|
213
212
|
webworker: false,
|
214
213
|
browser: false,
|
214
|
+
electron: true,
|
215
215
|
nwjs: false,
|
216
216
|
|
217
217
|
electronMain: context === "main",
|
@@ -255,10 +255,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
255
255
|
return {
|
256
256
|
node: true,
|
257
257
|
web: true,
|
258
|
-
nwjs: true,
|
259
258
|
webworker: null,
|
260
259
|
browser: false,
|
261
260
|
electron: false,
|
261
|
+
nwjs: true,
|
262
262
|
|
263
263
|
global: true,
|
264
264
|
nodeBuiltins: true,
|