-
-
Notifications
You must be signed in to change notification settings - Fork 116
merge.unique problem #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milestone
Comments
Same problem here |
quick'n'dirty solution const merge = require("webpack-merge");
const _ = require("lodash");
const PluginA = function (a) {
this.a = a;
};
const PluginB = function () { };
const PluginC = function () { };
console.log(
merge({
customizeArray(a, b, key) {
if (key === 'plugins') {
return [...b, ...a].reduce((sum, val)=>{
let inside = false;
for(const entry of sum){
if(entry.constructor && val.constructor && val.constructor.name == "PluginA") {
inside = inside || entry.constructor.name === val.constructor.name
}
}
if (!inside) {
sum.push(val);
}
return sum;
}, []);
}
// Fall back to default merging
return undefined;
}
})(
{
plugins: [new PluginB(), new PluginA(2)]
},
{
plugins: [new PluginA(1), new PluginC(), new PluginB()]
}
)
); |
This will be fixed in #135 (v5). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output
expect result
The text was updated successfully, but these errors were encountered: