env example to be webpack 5 compatible. #177, #180mergeWithRules. #172merge operation with mergeWithRules, use default merge behavior as a fallback. #167mergeWithRules when non-array matches are merged. #166TypeError if trying to use mergeWithRules with invalid configuration types for append/prepend/merge operations.merge (CustomizeRule.Merge) for objects at mergeWithRules. This is useful for merging loader options for example. #163mergeUnique to work with arbitrary order. #161mergeWithRules for cases that aren't matched. #157 #158mergeWithRules without a rule #151undefined is passed to merge as a structure to mergeConfiguration type through a generic to TypeScript to support both webpack 4 and 5 #141 #154In case you use webpack 4, please change your typing as instructed in the readme as the default type is loose but non-breaking.
CustomizeRule for TypeScript users #147RegExp to itself #145null #144<reference types="webpack-dev-server" /> from index.d.ts #143merge as default for backwards-compatibility with TypeScript. Now import merge from "webpack-merge"; works there. In CommonJS, the default alias is exposed through default property due to technical constraints.merge() and merge([]). Now {} is returned in these corner cases."importHelpers": false,merge.smart has been dropped as it's tricky to support all the corner cases. Instead, it's better to use the provided utilities to put together a merge that fits your case.mergeStrategy has been dropped in favor of using mergeWithCustomize with customizeArray and customizeObject.merge.multiple has been dropped as the functionality was too specific and it's better to implement in the user space if needed.merge has been moved as a regular import (i.e. import { merge } from 'webpack-merge').mergeWithCustomize.customizeArray supports wildcards now. Example: 'entry.*': 'prepend'. #45 #99Promise is being merged. It's better to wrap configuration within a Promise and merge inside it. #81unique merge from right to left to match behavior elsewhere. #119unique doesn't lose non-unique items to merge. #125Special thanks to Google and Addy Osmani for supporting the work financially as it allowed me to complete the work required by the new major release.
npm audit warning. #116merge.unique documentation. #103oneOf at merge.smart. #111customizeArray and customizeObject examples. #93merge.multiple to allow working with webpack multi-compiler mode. It accepts multiple objects and returns an array you can push to webpack. #74Breaking feature - merge.smart allows re-ordering loaders like below. #70
merge.smart(
{
loaders: [
{
test: /\.js$/,
loaders: ["babel"],
},
],
},
{
loaders: [
{
test: /\.js$/,
loaders: ["react-hot", "babel"],
},
],
}
);
// will become
{
loaders: [
{
test: /\.js$/,
// order of second argument is respected
loaders: ["react-hot", "babel"],
},
];
}
merge.smart should not merge a child missing include/exclude to a parent that has either. This is safer and more predictable behavior than the old one. #69merge.smart should not merge rules that have differing enforce fields. #65replace mode for merge.smartStrategy. #63merge.smartStrategy works with higher level nesting like 'module.rules.use': 'prepend'. #64merge.unique helper that plugs into customizeArray. This allows you to force only one plugin of a type to the end result. #58CopyWebpackPlugin handling. #56lodash instead of individual packages as latter has been discontinued. #52merge.smartStrategy(rules, plugins) as that caused other issues (prototype copying for complex cases). That needs a better approach. #55merge.smart. #53Feature - Allow merge.smartStrategy to merge plugin contents. API: merge.smartStrategy(rules, plugins). #44. Example:
const output = merge.smartStrategy(
{
entry: 'prepend', // or 'replace'
'module.loaders': 'prepend'
},
['LoaderOptionsPlugin']
)(object1, object2, object3, ...);
Breaking - Disallow overriding configuration with empty arrays/objects (#48). If you want to override, use merge.strategy. Example:
const a = {
entry: ["foo"],
};
const b = {
entry: [],
};
merge(a, b); // Yields a result, not b like before.
merge({ entry: {} }) should return the same result as input instead of a function.merge([<object>]) format. This works with all available functions. #46Feature - Allow merge behavior to be customized with overrides. Example:
var output = merge({
customizeArray(a, b, key) { return [...a, ...b]; },
customizeObject(a, b, key) { return mergeWith(a, b); }
})(object1, object2, object3, ...);
This allows you to guarantee array uniqueness and so on.
merge should not mutate inputs with mismatched keys.postcss in mind. It executes the functions, picks their results, and packs them again.merge.strategy. It literally replaces the old field value with the newer one. #40Feature: Add support for recursive definitions at merge.strategy. Example:
var output = merge.strategy({
entry: 'prepend',
'module.loaders': 'prepend'
})(object1, object2, object3, ...);
Feature: Add merge.smartStrategy. This combines the ideas of merge.smart and merge.strategy into one. Example:
var output = merge.smartStrategy({
entry: 'prepend',
'module.loaders': 'prepend'
})(object1, object2, object3, ...);
merge.strategy. Now you can customize merging behavior per root level configuration field. Example: merge.strategy({ entry: 'prepend' })(object1, object2, object3, ...);. #17merge.smart. It should pick up module.rules as you might expect now. #35merge.smart so that it appends loaders instead of prepending them. This is the logical thing to do as it allows you to specify behavior better as you merge. #32merge.smart merge loaders based on their full name instead of first letter. Thanks to @choffmeister. #26.merge.smart to merge configuration if include is defined. Thanks to @blackrabbit99. #20.include/exclude at merge.smart for loader definition too. Thanks to @Whoaa512. #16.include/exclude at merge.smart when its set only in a parent. #15.entry configuration.files field from package.json as it wasn't including the dist correctly.entry array merging behavior logical. Prepend makes sense only for loaders after all. #10concat and by dropping a redundant check. Thanks @davegomez!include or exclude, it will generate separate entries instead of merging. Without this the configuration might change in an unpredictable manner.preLoaders and postLoaders. Previously only loaders were supported.loaders field so that it prepends loaders instead of appending them. The benefit of this is that now it's possible to specialize loader setup in a predictable manner. For example you can have a linter set up at the root and expect it to become evaluated first always.merge object/array case (missing bind). The behavior should be correct now.merge.smart. Now merge behaves exactly as in 0.3.0 series.