Vue学习笔记_手贱报错_webpack

博客讲述了在更新到webpack5后遇到的报错情况,错误提示不再默认包含Node.js核心模块的polyfills。作者发现代码中意外引用了'console'导致问题,提醒开发者在升级或编写代码时要注意错误信息和代码规范。解决方案包括添加polyfill或移除无效引用。
摘要由CSDN通过智能技术生成

报错

BREAKING CHANGE: 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.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "console": require.resolve("console-browserify") }'
        - install 'console-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "console": false }`

一开始以为是webpack5报错问题,一直在找webpack.config.js文件在哪
结果???阅读代码发现多了个‘console’引用

//引入组件
import MyHeader from './components/MyHeader'
import MyList from './components/MyList'
import MyFooter from './components/MyFooter'
import { timeLog } from 'console'

引用了一个无用的东西报错

总结:观察error,注意代码规范

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值