-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
mergeWithRules and different rules for different properties #169
Comments
Since both The second one is harder as |
I'd expect the same, but that's not what's happening. |
Actually, not quite correct... The I mean, what you said would be a perfect solution for me, since this is what I would expect from the webpack configs merge. |
Yeah, I need to add some test for this case to lock the behavior.
… On 16.12.2020, at 20:22, JeB ***@***.***> wrote:
Actually, not quite correct... The test matches but the loader doesn't. But exclude is the test's sibling, not a child, so I'm not sure what's the expected behavior.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
So what would it be? Two separate entries in the |
Two separate entries might be the least surprising choice.
… On 16.12.2020, at 20:43, JeB ***@***.***> wrote:
So what would it be? Two separate entries in the rules array or something else?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Looking forward to seeing it! Thanks! |
Another question. What if we had a match in both test and loader but had additional fields that are different (like const conf1 = {
module: {
rules:[
{
"test": "/\\.scss$|\\.sass$/",
"include": ["/node_modules/"]
"use": [
{
"loader": "sass-loader",
"options": {
"sourceMap": true
}
}
]
}
]
}
};
const conf2 = {
module: {
rules:[
{
"test": "/\\.scss$|\\.sass$/",
"exclude": ["/node_modules/"],
"use": [
{
"loader": "sass-loader",
"options": {
anotherOption: "blah"
}
}
]
}
]
}
}; const mergeRules = {
module: {
rules: {
test: CustomizeRule.Match,
use: {
loader: CustomizeRule.Match,
options: CustomizeRule.Merge,
},
},
},
} |
@just-jeb That's a good one I need to test. I think it should merge those two matches and fall back to the default merge behavior for anything outside of the explicit definition. That means it would pick up both It's a good example of the flexibility of webpack loader configuration. In my personal use, I always go with |
Doesn't it contradict a bit the previous example? I think I'm missing a solid definition of how the
But it doesn't really explain how it should work. If it at least explained how it works as for today (based on the implemented algorithm) it would be really helpful I think. |
#213 just landed. It's possible it helps with this particular use case or at least can help to find a solution for it. |
In continuation to #167.
What would be the expected output to the following two objects merge?
with the following rules?
And what if I change the rules to the following?
Is this even legit?
The text was updated successfully, but these errors were encountered: