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

解决方案

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()],
  }
})

转载请说明出处内容投诉
CSS教程_站长资源网 » vue运行报错: webpack<5 used to include polyfills for node.js core modules by default.

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买