你好,我遇到了以下错误:
./node_modules/xml2js/lib/parser.js:38:17-47 - Error: Module not found: Error: Can't resolve 'timers' in '/Users/differentname/Desktop/workfiles/webdoc/ngx-admin-1/node_modules/xml2js/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "timers": require.resolve("timers-browserify") }'
- install 'timers-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "timers": false }
通过查看其他现有的解决方案,我尝试了以下操作:
- 运行
npm i timers-browserify
- 在
webpack.config.js
中添加:
module.exports = {
//
resolve: {
fallback: { "timers": false }
},
};
有没有其他解决方法?