Vue中启动提示polyfill缺少-webpack v5版本导致

安装

复制代码
npm i node-polyfill-webpack-plugin

因为我们的项目使用webpack v5,其中polyfill Node核心模块被删除。所以,我们安装它是为了在项目中访问这些模块

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()],
    optimization: {
      splitChunks: {
        chunks: "all",
      },
    },
  },
});
相关推荐
zuoerjinshu几秒前
WebSpoon9.0(KETTLE的WEB版本)编译 + tomcatdocker部署 + 远程调试教程
前端
lxmyzzs13 分钟前
解决Windows安装OpenClaw报错:无法加载npm.ps1,禁止运行脚本
前端·windows·npm·openclaw
昨日余光24 分钟前
建议收藏!我开发了一个免费无限制的AI绘画公益站!
开发语言·前端·javascript·ai作画·typescript
意疏31 分钟前
openJiuwen实战:用AsyncCallbackFramework为Agent增强器添加可观测性
java·服务器·前端
llxxyy卢31 分钟前
polar中等web部分题目
前端
wuhen_n31 分钟前
5年前端,我为什么要all in AI Agent?
前端·vue.js·ai编程
我爱切图40 分钟前
echart 移动端进行双指缩放时,当放大到最大级别后,手指没有离开屏幕,图表还会自动移动问题修复
前端
optimistic_chen1 小时前
【Vue入门】创建Vue工程环境和响应式函数
前端·javascript·vue.js·前端框架·html
南城书生1 小时前
Android Handler 机制源码分析
前端
南城书生1 小时前
Android 大图加载与 OOM 优化
前端