webpack-merge merge is not a function

user13912623 picture user13912623 · Jul 11, 2020 · Viewed 7.4k times · Source

I have trying to add react in the shopify theme. So configured react, webpack, babel manually. Webpack.dev.js

const merge  = require('webpack-merge');
const common = require("./webpack.common.js")

module.exports = merge(common, {
  mode: "development",
  devtool: "inline-source-map",
  watch: true
})

But I am getting error, merge is not a function. Thanks in advance.

Answer

Sunil Kumar Yadav picture Sunil Kumar Yadav · Jul 11, 2020

In a new version of webpack-merge, It is imported like below.

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