首页 > 解决方案 > Webpack 5.3.1 TypeError:Object.getOwnPropertyDescriptors 不是函数

问题描述

我正在尝试覆盖 IONIC 项目的 webpack.config.js。当我将 webpack 包含到 webpack.config.js 中时,它会出现错误。

Webpack 版本:5.1.3

**webpack.config.js**
var webpack = require('webpack');
**ERROR :**
TypeError: Object.getOwnPropertyDescriptors is not a function
    at mergeExports (/Users/XXXX/node_modules/webpack/lib/index.js:48:29)
    at Object.<anonymous> (/Users/XXXX/node_modules/webpack/lib/index.js:75:18)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous>

标签: javascriptangularwebpackionic2webpack-5

解决方案


推荐阅读