webpack——webpackMerge is not a function

2024-08-15 14:32:57 浏览数 (4)

前言

引入导致,因为webpackMerge的却不是一个函数呀~

内容

?> 正确示范

代码语言:javascript复制
const webpackMerge = require('webpack-merge')
module.exports = webpackMerge.merge(webpackBaseConfig, webpackProdConfig)

# 直接引用merge函数
const { merge } = require('webpack-merge')
module.exports = merge(webpackBaseConfig, webpackProdConfig)

!> 错误示范

代码语言:javascript复制
const webpackMerge = require('webpack-merge')
module.exports = webpackMerge(webpackBaseConfig, webpackProdConfig)

0 人点赞