webpack 5.102.1 → 5.103.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 +121 -134
- package/lib/CompatibilityPlugin.js +25 -2
- package/lib/Compilation.js +25 -2
- package/lib/ConcatenationScope.js +0 -15
- package/lib/CssModule.js +6 -1
- package/lib/DefinePlugin.js +11 -11
- package/lib/Dependency.js +8 -1
- package/lib/DependencyTemplate.js +1 -0
- package/lib/DotenvPlugin.js +457 -0
- package/lib/EnvironmentPlugin.js +19 -16
- package/lib/EvalSourceMapDevToolPlugin.js +16 -0
- package/lib/ExportsInfo.js +6 -2
- package/lib/ExternalModule.js +20 -28
- package/lib/ExternalModuleFactoryPlugin.js +10 -8
- package/lib/ExternalsPlugin.js +2 -1
- package/lib/ManifestPlugin.js +235 -0
- package/lib/Module.js +3 -0
- package/lib/ModuleGraph.js +2 -1
- package/lib/ModuleSourceTypesConstants.js +0 -6
- package/lib/MultiCompiler.js +1 -1
- package/lib/NodeStuffPlugin.js +419 -121
- package/lib/NormalModule.js +17 -16
- package/lib/RuntimeGlobals.js +22 -4
- package/lib/RuntimePlugin.js +27 -6
- package/lib/RuntimeTemplate.js +115 -56
- package/lib/SourceMapDevToolPlugin.js +20 -0
- package/lib/WebpackOptionsApply.js +33 -9
- package/lib/asset/AssetBytesGenerator.js +1 -1
- package/lib/asset/AssetGenerator.js +1 -2
- package/lib/asset/AssetSourceGenerator.js +1 -1
- package/lib/config/browserslistTargetHandler.js +5 -0
- package/lib/config/defaults.js +98 -18
- package/lib/config/normalization.js +2 -1
- package/lib/config/target.js +6 -0
- package/lib/css/CssGenerator.js +283 -57
- package/lib/css/CssLoadingRuntimeModule.js +2 -0
- package/lib/css/CssMergeStyleSheetsRuntimeModule.js +56 -0
- package/lib/css/CssModulesPlugin.js +84 -34
- package/lib/css/CssParser.js +1174 -667
- package/lib/css/walkCssTokens.js +97 -0
- package/lib/dependencies/CommonJsImportsParserPlugin.js +0 -9
- package/lib/dependencies/CommonJsPlugin.js +12 -0
- package/lib/dependencies/CssIcssExportDependency.js +247 -8
- package/lib/dependencies/CssIcssFromIdentifierDependency.js +124 -0
- package/lib/dependencies/CssIcssGlobalIdentifierDependency.js +48 -0
- package/lib/dependencies/CssIcssImportDependency.js +60 -54
- package/lib/dependencies/CssIcssLocalIdentifierDependency.js +61 -0
- package/lib/dependencies/{CssSelfLocalIdentifierDependency.js → CssIcssSelfLocalIdentifierDependency.js} +88 -10
- package/lib/dependencies/CssIcssSymbolDependency.js +31 -29
- package/lib/dependencies/CssImportDependency.js +15 -5
- package/lib/dependencies/ExternalModuleInitFragment.js +1 -1
- package/lib/dependencies/ExternalModuleInitFragmentDependency.js +95 -0
- package/lib/dependencies/HarmonyAcceptDependency.js +6 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +2 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +12 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +32 -21
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +12 -8
- package/lib/dependencies/HarmonyImportDependency.js +23 -27
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +28 -69
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -3
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +10 -8
- package/lib/dependencies/ImportDependency.js +8 -2
- package/lib/dependencies/ImportEagerDependency.js +6 -3
- package/lib/dependencies/ImportMetaPlugin.js +97 -9
- package/lib/dependencies/ImportParserPlugin.js +19 -21
- package/lib/dependencies/ImportPhase.js +121 -0
- package/lib/dependencies/ImportWeakDependency.js +6 -3
- package/lib/dependencies/ModuleDependency.js +5 -1
- package/lib/dependencies/ModuleHotAcceptDependency.js +1 -1
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +1 -8
- package/lib/hmr/LazyCompilationPlugin.js +1 -0
- package/lib/ids/IdHelpers.js +4 -1
- package/lib/index.js +6 -0
- package/lib/javascript/ChunkHelpers.js +16 -5
- package/lib/javascript/JavascriptGenerator.js +101 -101
- package/lib/javascript/JavascriptModulesPlugin.js +23 -13
- package/lib/javascript/JavascriptParser.js +142 -38
- package/lib/json/JsonParser.js +7 -1
- package/lib/library/ModuleLibraryPlugin.js +0 -10
- package/lib/library/SystemLibraryPlugin.js +4 -0
- package/lib/library/UmdLibraryPlugin.js +1 -1
- package/lib/node/NodeTargetPlugin.js +9 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +0 -2
- package/lib/optimize/ConcatenatedModule.js +161 -135
- package/lib/runtime/AsyncModuleRuntimeModule.js +28 -18
- package/lib/runtime/AutoPublicPathRuntimeModule.js +8 -3
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +89 -55
- package/lib/util/comparators.js +4 -3
- package/lib/util/internalSerializables.js +4 -4
- package/lib/util/jsonParseEvenBetterErrors.js +10 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +10 -4
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +8 -5
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +8 -4
- package/lib/web/FetchCompileWasmPlugin.js +0 -2
- package/lib/webpack.js +85 -82
- package/module.d.ts +5 -0
- package/package.json +16 -14
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +109 -27
- package/schemas/plugins/ManifestPlugin.check.d.ts +7 -0
- package/schemas/plugins/ManifestPlugin.check.js +6 -0
- package/schemas/plugins/ManifestPlugin.json +98 -0
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +16 -3
- package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerReferencePlugin.json +4 -1
- package/schemas/plugins/container/ExternalsType.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.json +4 -1
- package/schemas/plugins/css/CssAutoParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.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/json/JsonModulesPluginParser.check.js +1 -1
- package/types.d.ts +560 -293
- package/lib/dependencies/CssLocalIdentifierDependency.js +0 -250
|
@@ -65,7 +65,7 @@ class AssetSourceGenerator extends Generator {
|
|
|
65
65
|
} = ${JSON.stringify(encodedSource)};`;
|
|
66
66
|
} else {
|
|
67
67
|
runtimeRequirements.add(RuntimeGlobals.module);
|
|
68
|
-
sourceContent = `${
|
|
68
|
+
sourceContent = `${module.moduleArgument}.exports = ${JSON.stringify(
|
|
69
69
|
encodedSource
|
|
70
70
|
)};`;
|
|
71
71
|
}
|
package/lib/config/defaults.js
CHANGED
|
@@ -202,6 +202,7 @@ const {
|
|
|
202
202
|
* & { performance: NonNullable<WebpackOptionsNormalized["performance"]> }
|
|
203
203
|
* & { recordsInputPath: NonNullable<WebpackOptionsNormalized["recordsInputPath"]> }
|
|
204
204
|
* & { recordsOutputPath: NonNullable<WebpackOptionsNormalized["recordsOutputPath"]>
|
|
205
|
+
* & { dotenv: NonNullable<WebpackOptionsNormalized["dotenv"]> }
|
|
205
206
|
* }} WebpackOptionsNormalizedWithDefaults
|
|
206
207
|
*/
|
|
207
208
|
|
|
@@ -410,7 +411,10 @@ const applyWebpackOptionsDefaults = (options, compilerIndex) => {
|
|
|
410
411
|
|
|
411
412
|
applyExternalsPresetsDefaults(options.externalsPresets, {
|
|
412
413
|
targetProperties,
|
|
413
|
-
buildHttp: Boolean(options.experiments.buildHttp)
|
|
414
|
+
buildHttp: Boolean(options.experiments.buildHttp),
|
|
415
|
+
outputModule:
|
|
416
|
+
/** @type {NonNullable<WebpackOptionsNormalized["output"]["module"]>} */
|
|
417
|
+
(options.output.module)
|
|
414
418
|
});
|
|
415
419
|
|
|
416
420
|
applyLoaderDefaults(
|
|
@@ -513,6 +517,7 @@ const applyExperimentsDefaults = (
|
|
|
513
517
|
) => {
|
|
514
518
|
D(experiments, "futureDefaults", false);
|
|
515
519
|
D(experiments, "backCompat", !experiments.futureDefaults);
|
|
520
|
+
// TODO do we need sync web assembly in webpack@6?
|
|
516
521
|
D(experiments, "syncWebAssembly", false);
|
|
517
522
|
D(experiments, "asyncWebAssembly", experiments.futureDefaults);
|
|
518
523
|
D(experiments, "outputModule", false);
|
|
@@ -1042,6 +1047,35 @@ const applyModuleDefaults = (
|
|
|
1042
1047
|
type: CSS_MODULE_TYPE,
|
|
1043
1048
|
resolve
|
|
1044
1049
|
});
|
|
1050
|
+
// For CSS modules, i.e. `.class { composes: className from "./style.css" }`
|
|
1051
|
+
// We inherit for such constructions
|
|
1052
|
+
rules.push({
|
|
1053
|
+
dependency: /css-import-local-module/,
|
|
1054
|
+
type: CSS_MODULE_TYPE_MODULE,
|
|
1055
|
+
resolve
|
|
1056
|
+
});
|
|
1057
|
+
rules.push({
|
|
1058
|
+
dependency: /css-import-global-module/,
|
|
1059
|
+
type: CSS_MODULE_TYPE_GLOBAL,
|
|
1060
|
+
resolve
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
rules.push(
|
|
1064
|
+
{
|
|
1065
|
+
with: { type: "css" },
|
|
1066
|
+
parser: {
|
|
1067
|
+
exportType: "css-style-sheet"
|
|
1068
|
+
},
|
|
1069
|
+
resolve
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
assert: { type: "css" },
|
|
1073
|
+
parser: {
|
|
1074
|
+
exportType: "css-style-sheet"
|
|
1075
|
+
},
|
|
1076
|
+
resolve
|
|
1077
|
+
}
|
|
1078
|
+
);
|
|
1045
1079
|
}
|
|
1046
1080
|
rules.push(
|
|
1047
1081
|
{
|
|
@@ -1058,11 +1092,13 @@ const applyModuleDefaults = (
|
|
|
1058
1092
|
},
|
|
1059
1093
|
{
|
|
1060
1094
|
with: { type: JSON_MODULE_TYPE },
|
|
1061
|
-
type: JSON_MODULE_TYPE
|
|
1095
|
+
type: JSON_MODULE_TYPE,
|
|
1096
|
+
parser: { namedExports: false }
|
|
1062
1097
|
},
|
|
1063
1098
|
{
|
|
1064
1099
|
assert: { type: JSON_MODULE_TYPE },
|
|
1065
|
-
type: JSON_MODULE_TYPE
|
|
1100
|
+
type: JSON_MODULE_TYPE,
|
|
1101
|
+
parser: { namedExports: false }
|
|
1066
1102
|
},
|
|
1067
1103
|
{
|
|
1068
1104
|
with: { type: "text" },
|
|
@@ -1220,6 +1256,13 @@ const applyOutputDefaults = (
|
|
|
1220
1256
|
/** @type {boolean | undefined} */ (tp.nodePrefixForCoreModules)
|
|
1221
1257
|
)
|
|
1222
1258
|
);
|
|
1259
|
+
F(
|
|
1260
|
+
environment,
|
|
1261
|
+
"importMetaDirnameAndFilename",
|
|
1262
|
+
() =>
|
|
1263
|
+
// No optimistic, because it is new
|
|
1264
|
+
tp && /** @type {boolean | undefined} */ (tp.importMetaDirnameAndFilename)
|
|
1265
|
+
);
|
|
1223
1266
|
F(
|
|
1224
1267
|
environment,
|
|
1225
1268
|
"templateLiteral",
|
|
@@ -1301,6 +1344,8 @@ const applyOutputDefaults = (
|
|
|
1301
1344
|
if (tp) {
|
|
1302
1345
|
if (tp.global) return "global";
|
|
1303
1346
|
if (tp.globalThis) return "globalThis";
|
|
1347
|
+
// For universal target (i.e. code can be run in browser/node/worker etc.)
|
|
1348
|
+
if (tp.web === null && tp.node === null && tp.module) return "globalThis";
|
|
1304
1349
|
}
|
|
1305
1350
|
return "self";
|
|
1306
1351
|
});
|
|
@@ -1403,7 +1448,6 @@ const applyOutputDefaults = (
|
|
|
1403
1448
|
if (tp.nodeBuiltins) return "async-node";
|
|
1404
1449
|
if (
|
|
1405
1450
|
(tp.nodeBuiltins === null || tp.fetchWasm === null) &&
|
|
1406
|
-
asyncWebAssembly &&
|
|
1407
1451
|
output.module &&
|
|
1408
1452
|
environment.dynamicImport
|
|
1409
1453
|
) {
|
|
@@ -1527,35 +1571,47 @@ const applyOutputDefaults = (
|
|
|
1527
1571
|
* @param {object} options options
|
|
1528
1572
|
* @param {TargetProperties | false} options.targetProperties target properties
|
|
1529
1573
|
* @param {boolean} options.buildHttp buildHttp experiment enabled
|
|
1574
|
+
* @param {boolean} options.outputModule is output type is module
|
|
1530
1575
|
* @returns {void}
|
|
1531
1576
|
*/
|
|
1532
1577
|
const applyExternalsPresetsDefaults = (
|
|
1533
1578
|
externalsPresets,
|
|
1534
|
-
{ targetProperties, buildHttp }
|
|
1579
|
+
{ targetProperties, buildHttp, outputModule }
|
|
1535
1580
|
) => {
|
|
1581
|
+
/**
|
|
1582
|
+
* @param {keyof TargetProperties} key a key
|
|
1583
|
+
* @returns {boolean} true when target is universal, otherwise false
|
|
1584
|
+
*/
|
|
1585
|
+
const isUniversal = (key) =>
|
|
1586
|
+
Boolean(outputModule && targetProperties && targetProperties[key] === null);
|
|
1587
|
+
|
|
1536
1588
|
D(
|
|
1537
1589
|
externalsPresets,
|
|
1538
1590
|
"web",
|
|
1539
1591
|
/** @type {boolean | undefined} */
|
|
1540
|
-
(
|
|
1592
|
+
(
|
|
1593
|
+
!buildHttp &&
|
|
1594
|
+
targetProperties &&
|
|
1595
|
+
(targetProperties.web || isUniversal("node"))
|
|
1596
|
+
)
|
|
1541
1597
|
);
|
|
1542
1598
|
D(
|
|
1543
1599
|
externalsPresets,
|
|
1544
1600
|
"node",
|
|
1545
1601
|
/** @type {boolean | undefined} */
|
|
1546
|
-
(targetProperties && targetProperties.node)
|
|
1602
|
+
(targetProperties && (targetProperties.node || isUniversal("node")))
|
|
1547
1603
|
);
|
|
1548
1604
|
D(
|
|
1549
1605
|
externalsPresets,
|
|
1550
1606
|
"nwjs",
|
|
1551
1607
|
/** @type {boolean | undefined} */
|
|
1552
|
-
(targetProperties && targetProperties.nwjs)
|
|
1608
|
+
(targetProperties && (targetProperties.nwjs || isUniversal("nwjs")))
|
|
1553
1609
|
);
|
|
1554
1610
|
D(
|
|
1555
1611
|
externalsPresets,
|
|
1556
1612
|
"electron",
|
|
1557
1613
|
/** @type {boolean | undefined} */
|
|
1558
|
-
(targetProperties && targetProperties.electron)
|
|
1614
|
+
((targetProperties && targetProperties.electron) || isUniversal("electron"))
|
|
1559
1615
|
);
|
|
1560
1616
|
D(
|
|
1561
1617
|
externalsPresets,
|
|
@@ -1564,7 +1620,7 @@ const applyExternalsPresetsDefaults = (
|
|
|
1564
1620
|
(
|
|
1565
1621
|
targetProperties &&
|
|
1566
1622
|
targetProperties.electron &&
|
|
1567
|
-
targetProperties.electronMain
|
|
1623
|
+
(targetProperties.electronMain || isUniversal("electronMain"))
|
|
1568
1624
|
)
|
|
1569
1625
|
);
|
|
1570
1626
|
D(
|
|
@@ -1574,7 +1630,7 @@ const applyExternalsPresetsDefaults = (
|
|
|
1574
1630
|
(
|
|
1575
1631
|
targetProperties &&
|
|
1576
1632
|
targetProperties.electron &&
|
|
1577
|
-
targetProperties.electronPreload
|
|
1633
|
+
(targetProperties.electronPreload || isUniversal("electronPreload"))
|
|
1578
1634
|
)
|
|
1579
1635
|
);
|
|
1580
1636
|
D(
|
|
@@ -1584,7 +1640,7 @@ const applyExternalsPresetsDefaults = (
|
|
|
1584
1640
|
(
|
|
1585
1641
|
targetProperties &&
|
|
1586
1642
|
targetProperties.electron &&
|
|
1587
|
-
targetProperties.electronRenderer
|
|
1643
|
+
(targetProperties.electronRenderer || isUniversal("electronRenderer"))
|
|
1588
1644
|
)
|
|
1589
1645
|
);
|
|
1590
1646
|
};
|
|
@@ -1629,15 +1685,28 @@ const applyNodeDefaults = (
|
|
|
1629
1685
|
|
|
1630
1686
|
F(node, "global", () => {
|
|
1631
1687
|
if (targetProperties && targetProperties.global) return false;
|
|
1632
|
-
//
|
|
1688
|
+
// We use `warm` because overriding `global` with `globalThis` (or a polyfill) is sometimes safe (global.URL), sometimes unsafe (global.process), but we need to warn about it
|
|
1633
1689
|
return futureDefaults ? "warn" : true;
|
|
1634
1690
|
});
|
|
1635
1691
|
|
|
1636
1692
|
const handlerForNames = () => {
|
|
1637
|
-
|
|
1638
|
-
|
|
1693
|
+
// TODO webpack@6 remove `node-module` in favor of `eval-only`
|
|
1694
|
+
if (targetProperties) {
|
|
1695
|
+
if (targetProperties.node) {
|
|
1696
|
+
return "eval-only";
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
// For the "universal" target we only evaluate these values
|
|
1700
|
+
if (
|
|
1701
|
+
outputModule &&
|
|
1702
|
+
targetProperties.node === null &&
|
|
1703
|
+
targetProperties.web === null
|
|
1704
|
+
) {
|
|
1705
|
+
return "eval-only";
|
|
1706
|
+
}
|
|
1639
1707
|
}
|
|
1640
|
-
|
|
1708
|
+
|
|
1709
|
+
// TODO webpack@6 should we use `warn-even-only`?
|
|
1641
1710
|
return futureDefaults ? "warn-mock" : "mock";
|
|
1642
1711
|
};
|
|
1643
1712
|
|
|
@@ -1844,8 +1913,8 @@ const getResolveDefaults = ({
|
|
|
1844
1913
|
styleConditions.push(mode === "development" ? "development" : "production");
|
|
1845
1914
|
styleConditions.push("style");
|
|
1846
1915
|
|
|
1847
|
-
/** @type {
|
|
1848
|
-
|
|
1916
|
+
/** @type {ResolveOptions} */
|
|
1917
|
+
const cssResolveOptions = {
|
|
1849
1918
|
// We avoid using any main files because we have to be consistent with CSS `@import`
|
|
1850
1919
|
// and CSS `@import` does not handle `main` files in directories,
|
|
1851
1920
|
// you should always specify the full URL for styles
|
|
@@ -1855,6 +1924,17 @@ const getResolveDefaults = ({
|
|
|
1855
1924
|
extensions: [".css"],
|
|
1856
1925
|
preferRelative: true
|
|
1857
1926
|
};
|
|
1927
|
+
|
|
1928
|
+
/** @type {NonNullable<ResolveOptions["byDependency"]>} */
|
|
1929
|
+
(resolveOptions.byDependency)["css-import"] = cssResolveOptions;
|
|
1930
|
+
// For CSS modules, i.e. `.class { composes: className from "./style.css" }`
|
|
1931
|
+
// We inherit for such constructions
|
|
1932
|
+
/** @type {NonNullable<ResolveOptions["byDependency"]>} */
|
|
1933
|
+
(resolveOptions.byDependency)["css-import-local-module"] =
|
|
1934
|
+
cssResolveOptions;
|
|
1935
|
+
/** @type {NonNullable<ResolveOptions["byDependency"]>} */
|
|
1936
|
+
(resolveOptions.byDependency)["css-import-global-module"] =
|
|
1937
|
+
cssResolveOptions;
|
|
1858
1938
|
}
|
|
1859
1939
|
|
|
1860
1940
|
return resolveOptions;
|
|
@@ -178,6 +178,7 @@ const getNormalizedWebpackOptions = (config) => ({
|
|
|
178
178
|
return { ...devServer };
|
|
179
179
|
}),
|
|
180
180
|
devtool: config.devtool,
|
|
181
|
+
dotenv: config.dotenv,
|
|
181
182
|
entry:
|
|
182
183
|
config.entry === undefined
|
|
183
184
|
? { main: {} }
|
|
@@ -241,6 +242,7 @@ const getNormalizedWebpackOptions = (config) => ({
|
|
|
241
242
|
unsafeCache: module.unsafeCache,
|
|
242
243
|
parser: keyedNestedConfig(module.parser, cloneObject, {
|
|
243
244
|
javascript: (parserOptions) => ({
|
|
245
|
+
// TODO webpack 6 remove from `ModuleOptions`, keep only `*ByModuleType`
|
|
244
246
|
unknownContextRequest: module.unknownContextRequest,
|
|
245
247
|
unknownContextRegExp: module.unknownContextRegExp,
|
|
246
248
|
unknownContextRecursive: module.unknownContextRecursive,
|
|
@@ -252,7 +254,6 @@ const getNormalizedWebpackOptions = (config) => ({
|
|
|
252
254
|
wrappedContextRegExp: module.wrappedContextRegExp,
|
|
253
255
|
wrappedContextRecursive: module.wrappedContextRecursive,
|
|
254
256
|
wrappedContextCritical: module.wrappedContextCritical,
|
|
255
|
-
// TODO webpack 6 remove
|
|
256
257
|
strictExportPresence: module.strictExportPresence,
|
|
257
258
|
strictThisContextOnImports: module.strictThisContextOnImports,
|
|
258
259
|
...parserOptions
|
package/lib/config/target.js
CHANGED
|
@@ -42,6 +42,7 @@ const getDefaultTarget = (context) => {
|
|
|
42
42
|
* @property {boolean | null} require has require function available
|
|
43
43
|
* @property {boolean | null} nodeBuiltins has node.js built-in modules available
|
|
44
44
|
* @property {boolean | null} nodePrefixForCoreModules node.js allows to use `node:` prefix for core modules
|
|
45
|
+
* @property {boolean | null} importMetaDirnameAndFilename node.js allows to use `import.meta.dirname` and `import.meta.filename`
|
|
45
46
|
* @property {boolean | null} document has document available (allows script tags)
|
|
46
47
|
* @property {boolean | null} importScripts has importScripts available
|
|
47
48
|
* @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker
|
|
@@ -178,6 +179,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
178
179
|
nodeBuiltins: true,
|
|
179
180
|
// v16.0.0, v14.18.0
|
|
180
181
|
nodePrefixForCoreModules: Number(major) < 15 ? v(14, 18) : v(16),
|
|
182
|
+
// Added in: v21.2.0, v20.11.0, but Node.js will output experimental warning, we don't want it
|
|
183
|
+
// v24.0.0, v22.16.0 - This property is no longer experimental.
|
|
184
|
+
importMetaDirnameAndFilename: v(22, 16),
|
|
181
185
|
global: true,
|
|
182
186
|
document: false,
|
|
183
187
|
fetchWasm: false,
|
|
@@ -223,6 +227,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
223
227
|
// 15.0.0 - Node.js v16.5
|
|
224
228
|
// 14.0.0 - Mode.js v14.17, but prefixes only since v14.18
|
|
225
229
|
nodePrefixForCoreModules: v(15),
|
|
230
|
+
// 37.0.0 - Node.js v22.16
|
|
231
|
+
importMetaDirnameAndFilename: v(37),
|
|
226
232
|
|
|
227
233
|
require: true,
|
|
228
234
|
document: context === "renderer",
|