vue运行报错: webpack<5 used to include polyfills for node.js core modules by default.

在使用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

vue运行报错: 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 { defineConfig } = require('@vue/cli-service')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

module.exports = defineConfig({
  transpileDependencies: true,

  configureWebpack: {
    plugins: [new NodePolyfillPlugin()],
  }
})

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/e92c851d08.html