Merge pull request #15746 from jdanil/fix/experiments-css-override
fix: allow normalised experiments css value to be false
This commit is contained in:
commit
9fcaa24357
|
@ -3523,11 +3523,11 @@ export interface ExperimentsNormalizedExtra {
|
|||
/**
|
||||
* Enable css support.
|
||||
*/
|
||||
css?: CssExperimentOptions;
|
||||
css?: false | CssExperimentOptions;
|
||||
/**
|
||||
* Compile entrypoints and import()s only when they are accessed.
|
||||
*/
|
||||
lazyCompilation?: LazyCompilationOptions;
|
||||
lazyCompilation?: false | LazyCompilationOptions;
|
||||
}
|
||||
/**
|
||||
* If an dependency matches exactly a property of the object, the property value is used as dependency.
|
||||
|
|
|
@ -485,7 +485,7 @@ const applyJavascriptParserOptionsDefaults = (
|
|||
* @param {boolean} options.cache is caching enabled
|
||||
* @param {boolean} options.syncWebAssembly is syncWebAssembly enabled
|
||||
* @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled
|
||||
* @param {CssExperimentOptions} options.css is css enabled
|
||||
* @param {CssExperimentOptions|false} options.css is css enabled
|
||||
* @param {boolean} options.futureDefaults is future defaults enabled
|
||||
* @param {boolean} options.isNode is node target platform
|
||||
* @returns {void}
|
||||
|
@ -1122,7 +1122,7 @@ const applyPerformanceDefaults = (performance, { production }) => {
|
|||
* @param {Object} options options
|
||||
* @param {boolean} options.production is production
|
||||
* @param {boolean} options.development is development
|
||||
* @param {CssExperimentOptions} options.css is css enabled
|
||||
* @param {CssExperimentOptions|false} options.css is css enabled
|
||||
* @param {boolean} options.records using records
|
||||
* @returns {void}
|
||||
*/
|
||||
|
|
|
@ -178,11 +178,10 @@ const getNormalizedWebpackOptions = config => {
|
|||
),
|
||||
lazyCompilation: optionalNestedConfig(
|
||||
experiments.lazyCompilation,
|
||||
options =>
|
||||
options === true ? {} : options === false ? undefined : options
|
||||
options => (options === true ? {} : options)
|
||||
),
|
||||
css: optionalNestedConfig(experiments.css, options =>
|
||||
options === true ? {} : options === false ? undefined : options
|
||||
options === true ? {} : options
|
||||
)
|
||||
})),
|
||||
externals: config.externals,
|
||||
|
|
|
@ -897,7 +897,10 @@
|
|||
},
|
||||
"css": {
|
||||
"description": "Enable css support.",
|
||||
"oneOf": [
|
||||
"anyOf": [
|
||||
{
|
||||
"enum": [false]
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/CssExperimentOptions"
|
||||
}
|
||||
|
@ -913,7 +916,10 @@
|
|||
},
|
||||
"lazyCompilation": {
|
||||
"description": "Compile entrypoints and import()s only when they are accessed.",
|
||||
"oneOf": [
|
||||
"anyOf": [
|
||||
{
|
||||
"enum": [false]
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/LazyCompilationOptions"
|
||||
}
|
||||
|
|
|
@ -2221,6 +2221,84 @@ describe("snapshots", () => {
|
|||
+ /^(.+?[\\\\/]node_modules[\\\\/])/,
|
||||
`)
|
||||
);
|
||||
|
||||
test(
|
||||
"experiments.futureDefaults w/ experiments.css disabled",
|
||||
{
|
||||
experiments: {
|
||||
css: false,
|
||||
futureDefaults: true
|
||||
}
|
||||
},
|
||||
e =>
|
||||
e.toMatchInlineSnapshot(`
|
||||
- Expected
|
||||
+ Received
|
||||
|
||||
@@ ... @@
|
||||
- "asyncWebAssembly": false,
|
||||
- "backCompat": true,
|
||||
+ "asyncWebAssembly": true,
|
||||
+ "backCompat": false,
|
||||
@@ ... @@
|
||||
- "cacheUnaffected": false,
|
||||
- "css": undefined,
|
||||
- "futureDefaults": false,
|
||||
+ "cacheUnaffected": true,
|
||||
+ "css": false,
|
||||
+ "futureDefaults": true,
|
||||
@@ ... @@
|
||||
- "topLevelAwait": false,
|
||||
+ "topLevelAwait": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+ "test": /\\.wasm$/i,
|
||||
+ "type": "webassembly/async",
|
||||
@@ ... @@
|
||||
+ "mimetype": "application/wasm",
|
||||
+ "rules": Array [
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
@@ ... @@
|
||||
+ "exportsPresence": "error",
|
||||
@@ ... @@
|
||||
- "__dirname": "mock",
|
||||
- "__filename": "mock",
|
||||
- "global": true,
|
||||
+ "__dirname": "warn-mock",
|
||||
+ "__filename": "warn-mock",
|
||||
+ "global": "warn",
|
||||
@@ ... @@
|
||||
- "hashDigestLength": 20,
|
||||
- "hashFunction": "md4",
|
||||
+ "hashDigestLength": 16,
|
||||
+ "hashFunction": "xxhash64",
|
||||
@@ ... @@
|
||||
- "<cwd>/node_modules/",
|
||||
+ /^(.+?[\\\\/]node_modules[\\\\/])/,
|
||||
`)
|
||||
);
|
||||
});
|
||||
|
||||
it("should result in the same target options for same target", () => {
|
||||
|
|
|
@ -3543,12 +3543,12 @@ declare interface ExperimentsNormalizedExtra {
|
|||
/**
|
||||
* Enable css support.
|
||||
*/
|
||||
css?: CssExperimentOptions;
|
||||
css?: false | CssExperimentOptions;
|
||||
|
||||
/**
|
||||
* Compile entrypoints and import()s only when they are accessed.
|
||||
*/
|
||||
lazyCompilation?: LazyCompilationOptions;
|
||||
lazyCompilation?: false | LazyCompilationOptions;
|
||||
}
|
||||
declare abstract class ExportInfo {
|
||||
name: string;
|
||||
|
|
Loading…
Reference in New Issue