Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

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

I'm using webpack-merge to combine two webpack.config files together but I keep getting the error "TypeError: merge is not a function when I run the command "webpack --config ./config/webpack.config.prod.js"

Has anybody else run across this issue?

webpack.config.prod.js

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const TerserPlugin = require('terser-webpack-plugin');
const commonConfig= require('./webpack.config.common');
const merge = require('webpack-merge');

module.exports = merge(commonConfig, {

    //config code
 
})
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

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",
  },
over 4 years ago · Santiago Trujillo Report

0

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');
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!