webpack-merge
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -0,1 +1,6 @@ | ||
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 | ||
@@ -2,0 +7,0 @@ ================== |
'use strict'; | ||
var _values2 = require('lodash/values'); | ||
var _values3 = _interopRequireDefault(_values2); | ||
var _unionWith2 = require('lodash/unionWith'); | ||
@@ -73,2 +77,10 @@ | ||
var mergeMultiple = function mergeMultiple() { | ||
for (var _len3 = arguments.length, sources = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
sources[_key3] = arguments[_key3]; | ||
} | ||
return (0, _values3.default)(merge(sources)); | ||
}; | ||
// rules: { <field>: <'append'|'prepend'|'replace'> } | ||
@@ -142,2 +154,3 @@ // All default to append but you can override here | ||
module.exports = merge; | ||
module.exports.multiple = mergeMultiple; | ||
module.exports.smart = mergeSmart; | ||
@@ -144,0 +157,0 @@ module.exports.strategy = mergeStrategy; |
@@ -5,3 +5,3 @@ { | ||
"author": "Juho Vepsalainen <bebraw@gmail.com>", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "build": "babel src -d lib", |
@@ -315,2 +315,39 @@ [![build status](https://secure.travis-ci.org/survivejs/webpack-merge.svg)](http://travis-ci.org/survivejs/webpack-merge) [![bitHound Score](https://www.bithound.io/github/survivejs/webpack-merge/badges/score.svg)](https://www.bithound.io/github/survivejs/webpack-merge) [![codecov](https://codecov.io/gh/survivejs/webpack-merge/branch/master/graph/badge.svg)](https://codecov.io/gh/survivejs/webpack-merge) | ||
## Multiple Merging | ||
### **`merge.multiple(...configuration | [...configuration])`** | ||
Sometimes you may need to support multiple targets, *webpack-merge* will accept an object where each key represents the target configuration. The output becomes an *array* of configurations where matching keys are merged and non-matching keys are added. | ||
```javascript | ||
var path = require('path'); | ||
var baseConfig = { | ||
server: { | ||
target: 'node', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'lib.node.js' | ||
} | ||
}, | ||
client: { | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'lib.js' | ||
} | ||
} | ||
}; | ||
// specialized configuration | ||
var production = { | ||
client: { | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].[hash].js' | ||
} | ||
} | ||
} | ||
module.exports = merge.multiple(baseConfig, production) | ||
``` | ||
> Check out [SurviveJS - Webpack and React](http://survivejs.com/) to dig deeper into the topic. | ||
@@ -317,0 +354,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38185
392
364