# Changelog
## 5.7.3 / 2020-12-22
- Fix - Don't merge strings with objects in `mergeWithRules`. #172
## 5.7.2 / 2020-12-16
- Fix - If there's no match when using `merge` operation with `mergeWithRules`, use default merge behavior as a fallback. #167
## 5.7.1 / 2020-12-16
- Fix - Fix a merge failure for `mergeWithRules` when non-array matches are merged. #166
## 5.7.0 / 2020-12-12
- Feat - Throw a `TypeError` if trying to use `mergeWithRules` with invalid configuration types for `append`/`prepend`/`merge` operations.
## 5.6.1 / 2020-12-11
- Fix - Drop extraneous logging.
## 5.6.0 / 2020-12-11
- Feat - Support `merge` (`CustomizeRule.Merge`) for objects at `mergeWithRules`. This is useful for merging loader options for example. #163
## 5.5.0 / 2020-12-10
- Feat - Allow `mergeWithRules` to merge based on rules without a match. #151 #159
## 5.4.1 / 2020-12-08
- Fix - Allow `mergeUnique` to work with arbitrary order. #161
## 5.4.0 / 2020-10-30
- Fix - Fall back correctly in `mergeWithRules` for cases that aren't matched. #157 #158
- Fix - Don't throw if using `mergeWithRules` without a rule #151
- Feat - Throw if `undefined` is passed to `merge` as a structure to merge
## 5.3.0 / 2020-10-30
- Fix - Expose `Configuration` type through a generic to TypeScript to support both webpack 4 and 5 #141 #154
In case you use webpack 4, please change your typing as instructed in the readme as the default type is loose but non-breaking.
## 5.2.0 / 2020-10-07
- Feature - Support advanced merging cases through `mergeWithRules` #146 #149
## 5.1.4 / 2020-09-09
- Fix - Expose `CustomizeRule` for TypeScript users #147
## 5.1.3 / 2020-08-30
- Fix - Allow merging a `RegExp` to itself #145
## 5.1.2 / 2020-08-18
- Fix - Allow overriding an object field with `null` #144
## 5.1.1 / 2020-08-04
- Fix - Drop `` from **index.d.ts** #143
## 5.1.0 / 2020-08-03
- Feature - Expose `merge` 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.
## 5.0.9 / 2020-07-09
- Fix - Don't crash on `merge()` and `merge([])`. Now `{}` is returned in these corner cases.
## 5.0.8 / 2020-07-07
- Fix - Support Node 10 #138
## 5.0.7 / 2020-07-06
- Fix - Drop tslib dependency by setting `"importHelpers": false,`
## 5.0.6 / 2020-07-06
- Fix - Add tslib to dependencies
## 5.0.5 / 2020-07-06
- Tech - Optimize build size (UMD isn't needed)
## 5.0.4 / 2020-07-06
- Documentation - Use CommonJS imports at the examples. #137
## 5.0.3 / 2020-07-06
- Feature - Support TypeScript out of the box. #84 #86 #95 #110 #112
- Deprecation - `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.
- Deprecation - `mergeStrategy` has been dropped in favor of using `mergeWithCustomize` with `customizeArray` and `customizeObject`.
- Deprecation - `merge.multiple` has been dropped as the functionality was too specific and it's better to implement in the user space if needed.
- Breaking - `merge` has been moved as a regular import (i.e. `import { merge } from 'webpack-merge'`).
- Breaking - Merge customization has been moved behind `mergeWithCustomize`.
- Breaking - Bump supported Node version to 12
- Feature - `customizeArray` supports wildcards now. Example: `'entry.*': 'prepend'`. #45 #99
- Feature - Throw an error in case a `Promise` is being merged. It's better to wrap configuration within a `Promise` and merge inside it. #81
- Fix - Drop lodash in favor of simpler dependencies. #134
- Fix - Make `unique` merge from right to left to match behavior elsewhere. #119
- Fix - Make sure `unique` doesn't lose non-unique items to merge. #125
Special 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.
## 4.2.2 / 2019-08-27
- Fix - Update minimum version of lodash to 4.17.15 in order to avoid `npm audit warning`. #116
- Docs - Improve `merge.unique` documentation. #103
- Docs - Add clear note about precedence. #115
## 4.2.1 / 2019-01-04
- Feature - Support `oneOf` at `merge.smart`. #111
- Fix - If there's only single array to merge, clone it. #106
## 4.1.4 / 2018-08-01
- Maintenance - Remove bitHound from the README as it closed down. #102
## 4.1.3 / 2018-06-14
- Fix - Smart merge respects the existing loader order #79, #101
## 4.1.2 / 2017-02-22
- Maintenance - Update lodash, #97, #98
## 4.1.1 / 2017-11-01
- Docs - Add `customizeArray` and `customizeObject` examples. #93
## 4.1.0 / 2017-03-16
- Feature - `merge.multiple` to allow working with webpack multi-compiler mode. It accepts multiple objects and returns an array you can push to webpack. #74
## 4.0.0 / 2017-03-06
- Breaking feature - `merge.smart` allows re-ordering loaders like below. #70
```javascript
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"],
},
];
}
```
## 3.0.0 / 2017-02-19
- Breaking fix - `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. #69
## 2.6.1 / 2017-01-29
- Bug fix - `merge.smart` should not merge rules that have differing `enforce` fields. #65
## 2.6.0 / 2017-01-27
- Bug fix - Support `replace` mode for `merge.smartStrategy`. #63
## 2.5.0 / 2017-01-26
- Bug fix - Make sure `merge.smartStrategy` works with higher level nesting like `'module.rules.use': 'prepend'`. #64
## 2.4.0 / 2017-01-12
- Feature - Add `merge.unique` helper that plugs into `customizeArray`. This allows you to force only one plugin of a type to the end result. #58
## 2.3.1 / 2017-01-06
- Bug fix - Clear up `CopyWebpackPlugin` handling. #56
## 2.3.0 / 2017-01-06
- Refactor - Depend only on `lodash` instead of individual packages as latter has been discontinued. #52
## 2.2.0 / 2017-01-05
- Bug fix - Drop `merge.smartStrategy(rules, plugins)` as that caused other issues (prototype copying for complex cases). That needs a better approach. #55
## 2.1.1 / 2017-01-05
- Bug fix - Avoid recursion at `merge.smart`. #53
## 2.1.0 / 2017-01-05
- Feature - Allow `merge.smartStrategy` to merge plugin contents. API: `merge.smartStrategy(rules, plugins)`. #44. Example:
```javascript
const output = merge.smartStrategy(
{
entry: 'prepend', // or 'replace'
'module.loaders': 'prepend'
},
['LoaderOptionsPlugin']
)(object1, object2, object3, ...);
```
## 2.0.0 / 2016-12-22
- Breaking - Disallow overriding configuration with empty arrays/objects (#48). If you want to override, use `merge.strategy`. Example:
```javascript
const a = {
entry: ["foo"],
};
const b = {
entry: [],
};
merge(a, b); // Yields a result, not b like before.
```
## 1.1.2 / 2016-12-18
- Bug fix - `merge({ entry: {} })` should return the same result as input instead of a function.
## 1.1.1 / 2016-12-11
- Bug fix - Support previously undocumented, yet used, `merge([