webpack-merge
Advanced tools
Comparing version 5.6.1 to 5.7.0
# Changelog | ||
## 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 | ||
@@ -4,0 +8,0 @@ |
@@ -178,13 +178,23 @@ "use strict"; | ||
case types_1.CustomizeRule.Append: | ||
var appendValue = last(bMatches)[k]; | ||
if (!isArray(v) || !isArray(appendValue)) { | ||
throw new TypeError("Trying to append non-arrays"); | ||
} | ||
ret[k] = | ||
bMatches.length > 0 | ||
? v.concat(last(bMatches)[k]) | ||
: v; | ||
bMatches.length > 0 ? v.concat(appendValue) : v; | ||
break; | ||
case types_1.CustomizeRule.Merge: | ||
// @ts-ignore: The assumption here is that both are objects | ||
ret[k] = __assign(__assign({}, v), last(bMatches)[k]); | ||
var lastValue = last(bMatches)[k]; | ||
if (!utils_1.isPlainObject(v) || !utils_1.isPlainObject(lastValue)) { | ||
throw new TypeError("Trying to merge non-objects"); | ||
} | ||
// @ts-ignore: These should be objects now | ||
ret[k] = __assign(__assign({}, v), lastValue); | ||
break; | ||
case types_1.CustomizeRule.Prepend: | ||
ret[k] = bMatches.length > 0 ? last(bMatches)[k].concat(v) : v; | ||
var prependValue = last(bMatches)[k]; | ||
if (!isArray(v) || !isArray(prependValue)) { | ||
throw new TypeError("Trying to prepend non-arrays"); | ||
} | ||
ret[k] = bMatches.length > 0 ? prependValue.concat(v) : v; | ||
break; | ||
@@ -191,0 +201,0 @@ case types_1.CustomizeRule.Replace: |
@@ -14,3 +14,3 @@ "use strict"; | ||
function isPlainObject(a) { | ||
if (a === null) { | ||
if (a === null || Array.isArray(a)) { | ||
return false; | ||
@@ -17,0 +17,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Juho Vepsalainen <bebraw@gmail.com>", | ||
"version": "5.6.1", | ||
"version": "5.7.0", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "build": "tsc", |
@@ -278,3 +278,3 @@ [![Financial Contributors on Open Collective](https://opencollective.com/webpack-merge/all/badge.svg?label=financial+contributors)](https://opencollective.com/webpack-merge) [![build status](https://secure.travis-ci.org/survivejs/webpack-merge.svg)](http://travis-ci.org/survivejs/webpack-merge) [![codecov](https://codecov.io/gh/survivejs/webpack-merge/branch/master/graph/badge.svg)](https://codecov.io/gh/survivejs/webpack-merge) | ||
Check out [SurviveJS - Webpack](http://survivejs.com/) to dig deeper into webpack. The free book uses _webpack-merge_ extensively and shows you how to compose your configuration to keep it maintainable. | ||
Check out [SurviveJS - Webpack 5](http://survivejs.com/) to dig deeper into webpack. The free book uses **webpack-merge** extensively and shows you how to compose your configuration to keep it maintainable. | ||
@@ -315,2 +315,2 @@ I am also available as a consultant in case you require specific assistance. I can contribute particularly in terms of improving maintainability of the setup while speeding it up and pointing out better practices. In addition to improving developer productivity, the work has impact on the end users of the product in terms of reduced application size and loading times. | ||
_webpack-merge_ is available under MIT. See LICENSE for more details. | ||
**webpack-merge** is available under MIT. See LICENSE for more details. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55537
468