From a89a35d30276a3d284d304ee710442ee03da351b Mon Sep 17 00:00:00 2001
From: JeB <9823087+just-jeb@users.noreply.github.com>
Date: Tue, 22 Dec 2020 15:45:19 +0200
Subject: [PATCH] fix(custom-webpack): allow merging loader name with loader
 object (#912)

---
 packages/custom-webpack/package.json          |  2 +-
 .../src/webpack-config-merger.spec.ts         | 55 +++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/packages/custom-webpack/package.json b/packages/custom-webpack/package.json
index 0e9217953..8240454ef 100644
--- a/packages/custom-webpack/package.json
+++ b/packages/custom-webpack/package.json
@@ -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"
   }
 }
diff --git a/packages/custom-webpack/src/webpack-config-merger.spec.ts b/packages/custom-webpack/src/webpack-config-merger.spec.ts
index 803b2aee7..310026d8a 100644
--- a/packages/custom-webpack/src/webpack-config-merger.spec.ts
+++ b/packages/custom-webpack/src/webpack-config-merger.spec.ts
@@ -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);
+  });
 });