Skip to content

Commit

Permalink
fix(custom-webpack): allow merging loader name with loader object (#912)
Browse files Browse the repository at this point in the history
  • Loading branch information
just-jeb authored Dec 22, 2020
1 parent 97c59cc commit a89a35d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/custom-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"@angular-devkit/core": "^11.0.0",
"lodash": "^4.17.15",
"ts-node": "^9.0.0",
"webpack-merge": "^5.7.2"
"webpack-merge": "^5.7.3"
}
}
55 changes: 55 additions & 0 deletions packages/custom-webpack/src/webpack-config-merger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,59 @@ describe('Webpack config merger test', () => {

expect(mergeConfigs(conf1, conf2)).toEqual(expected);
});

it('should merge loader name with loader object', () => {
const conf1 = {
module: {
rules: [
{
test: 'some-test',
use: ['hello-loader'],
},
],
},
};

const conf2 = {
module: {
rules: [
{
test: 'another-test',
use: [
{
loader: 'another-loader',
options: {
someoption: 'hey',
},
},
],
},
],
},
};

const expected = {
module: {
rules: [
{
test: 'some-test',
use: ['hello-loader'],
},
{
test: 'another-test',
use: [
{
loader: 'another-loader',
options: {
someoption: 'hey',
},
},
],
},
],
},
};

expect(mergeConfigs(conf1, conf2)).toEqual(expected);
});
});

0 comments on commit a89a35d

Please sign in to comment.