在使用vue3开发是安装使用web3等工具,运行报错
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
解决方案
1、安装 node-polyfill-webpack-plugin
npm install node-polyfill-webpack-plugin
2、vue.config.js中修改配置
const { defineConfig } = require('@vue/cli-service')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [new NodePolyfillPlugin()],
}
})