Skip to main content

Updating webpack-merge to version 5

This website uses Hugo and Webpack to build content. The dependency webpack-merge package moved from version 4 to 5.

diff --git a/package.json b/package.json
index 92409ec..b79763d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
     "webpack-dev-server": "^3.11.0",
-    "webpack-merge": "^4.2.2",
+    "webpack-merge": "^5.0.6",
     "whatwg-fetch": "^3.0.0"
   }

There are some breaking changes in webpack-merge version 5. If you encounter new build errors, the simple fix for me was:

diff --git a/webpack.dev.js b/webpack.dev.js
index 15d82f2..83b7fc2 100644
--- a/webpack.dev.js
+++ b/webpack.dev.js
@@ -1,4 +1,4 @@
-const merge = require("webpack-merge");
+const {merge} = require("webpack-merge");
 const path = require("path");
 const {CleanWebpackPlugin} = require("clean-webpack-plugin");
 const MiniCssExtractPlugin = require("mini-css-extract-plugin");