在使用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()],
  }
})
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐