Merging two module.rules just appends
See original GitHub issueThis is the test I want to run but it seems that the latest version does not longer merge rules.
it('Should merge loader options', () => {
const output = merge(
{
module: {
rules: [
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'sass-loader' }],
},
],
},
},
{
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
options: {
modules: true,
},
},
],
},
],
},
}
);
const expected = {
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
options: {
modules: true,
},
},
{ loader: 'sass-loader' },
],
},
],
},
};
expect(output).toEqual(expected);
});
Output is:
[
{ test: /\.css$/, use: [ [Object], [Object] ] },
{ test: /\.css$/, use: [ [Object] ] }
]
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (12 by maintainers)
Top Results From Across the Web
Using webpack-merge to prepend loaders to a rules `use` array
So I tried to use merge.smartStrategy({ 'module.rules.use': 'prepend' })() , but I get an error: TypeError: this[MODULE_TYPE] ...
Read more >Composing Configuration - SurviveJS
In composition based approach, you split webpack configuration and then merge it together. The problem is that a normal way of merging objects...
Read more >Solved: Join/Append 2 Lists - Anaplan Community
Solved: Hi team, This is an usual question but I have 2 lists (1 customer & 1 future revenue to be derived off...
Read more >Node.js — How to Merge Objects - Future Studio
Remember that Object.assign modifies the target object (the first parameter). To ensure a new object without changing any of the sources, you ...
Read more >Merge/Append using Stata - Princeton University
Merge – adds variables to a dataset. ... Merging two datasets require that both have at least one variable in ... If you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@muuvmuuv Yeah, using a strategy would fit well. I’ll go that way (might need a day or two due to other work).
@muuvmuuv Yeah, that’s a good idea since then you could build more matchers. I have to check the code to understand the implications but I see the use case.