Getting Error from webpack-cli: "TypeError: merge is not a function" in webpack config

Solution 1:

You are importing merge incorrectly. Try it like this:

const { merge } = require('webpack-merge');

UPD: Based on the following changelog, starting with webpack-merge 5.0.3 and higher, you should use the code I provided above. If the version is lower than 5.0.3, then you need to use:

const merge = require('webpack-merge');

Solution 2:

Also you can do this using cmd.

webpack -m -c ./webpack.config.js -c ./webpack.dev.js

or you can create a script in package.json for faster use

  "scripts": {
    "build:dev": "webpack -m -c ./webpack.config.js -c 
    ./webpack.dev.js",
  },