vue运行报错:BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
vue运行报错:BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
解决方案
1.安装 node-polyfill-webpack-plugin
npm install node-polyfill-webpack-plugin
2.vue.config.js中修改配置
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [new NodePolyfillPlugin()],
}
// 或者
configureWebpack: (config) => {
const plugins = []
plugins.push(new NodePolyfillPlugin())
}
})
版权声明:本文为qq_43472877原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。