diff --git a/README.md b/README.md index 6fc4ccc..04006c6 100644 --- a/README.md +++ b/README.md @@ -574,6 +574,32 @@ config.performance .assetFilter(assetFilter) ``` +#### Configuring optimizations: shorthand methods + +```js +config.optimization : ChainedMap + +config.optimization + .concatenateModules(concatenateModules) + .flagIncludedChunks(flagIncludedChunks) + .mergeDuplicateChunks(mergeDuplicateChunks) + .minimize(minimize) + .minimizer(minimizer) + .namedChunks(namedChunks) + .namedModules(namedModules) + .nodeEnv(nodeEnv) + .noEmitOnErrors(noEmitOnErrors) + .occurrenceOrder(occurrenceOrder) + .portableRecords(portableRecords) + .providedExports(providedExports) + .removeAvailableModules(removeAvailableModules) + .removeEmptyChunks(removeEmptyChunks) + .runtimeChunk(runtimeChunk) + .sideEffects(sideEffects) + .splitChunks(splitChunks) + .usedExports(usedExports) +``` + #### Config plugins ```js @@ -930,10 +956,12 @@ config.merge({ amd, bail, cache, - devtool, context, + devtool, externals, loader, + mode, + parallelism, profile, recordsPath, recordsInputPath, @@ -985,6 +1013,27 @@ config.merge({ [key]: value }, + optimizations: { + concatenateModules, + flagIncludedChunks, + mergeDuplicateChunks, + minimize, + minimizer, + namedChunks, + namedModules, + nodeEnv, + noEmitOnErrors, + occurrenceOrder, + portableRecords, + providedExports, + removeAvailableModules, + removeEmptyChunks, + runtimeChunk, + sideEffects, + splitChunks, + usedExports, + }, + performance: { [key]: value, diff --git a/src/Config.js b/src/Config.js index 84d307b..c0cfb4b 100644 --- a/src/Config.js +++ b/src/Config.js @@ -26,8 +26,8 @@ module.exports = class extends ChainedMap { 'amd', 'bail', 'cache', - 'devtool', 'context', + 'devtool', 'externals', 'loader', 'mode', diff --git a/src/Optimization.js b/src/Optimization.js index 1e9db53..cb061f8 100644 --- a/src/Optimization.js +++ b/src/Optimization.js @@ -4,24 +4,24 @@ module.exports = class extends ChainedMap { constructor(parent) { super(parent); this.extend([ - 'removeAvailableModules', - 'removeEmptyChunks', - 'mergeDuplicateChunks', - 'flagIncludedChunks', - 'occurrenceOrder', - 'sideEffects', - 'providedExports', - 'usedExports', 'concatenateModules', - 'splitChunks', - 'runtimeChunk', - 'noEmitOnErrors', - 'namedModules', - 'namedChunks', - 'portableRecords', + 'flagIncludedChunks', + 'mergeDuplicateChunks', 'minimize', 'minimizer', + 'namedChunks', + 'namedModules', 'nodeEnv', + 'noEmitOnErrors', + 'occurrenceOrder', + 'portableRecords', + 'providedExports', + 'removeAvailableModules', + 'removeEmptyChunks', + 'runtimeChunk', + 'sideEffects', + 'splitChunks', + 'usedExports', ]); } };