Webpack 5收到填充错误?!?!我的JavaScript Reaction项目在尝试编译我的webpack.config.js文件时收到PolyFill错误

Webpack 5 Receiving a Polyfill Error?!?! My JavaScript React project is receiving a polyfill error while trying to compile my webpack.config.js file(Webpack 5收到填充错误?!?!我的JavaScript Reaction项目在尝试编译我的webpack.config.js文件时收到PolyFill错误) - IT屋-程序员软件开发技术

本文介绍了Webpack 5收到填充错误?!?!我的JavaScript Reaction项目在尝试编译我的webpack.config.js文件时收到PolyFill错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习一门关于Udemy的课程(对于我们其他人来说,这是Brad Schiff的Reaction课程here),我收到了一个与webpack有关的错误,这使它无法编译。 当我尝试从我正在学习的UDEMY课程编译我的webpack文件时,我收到了以下错误...以下是我在终端上收到的错误的图片: please view it here

以下是错误的文本,但请以屏幕截图形式查看链接以了解更多详细信息

数据-lang="js"数据-隐藏="假"数据-控制台="真"数据-巴贝尔="假">
Module not found: Error: Can't resolve 'path' in '/Users/seanmodd/Development/2021/BradSchiff/Frontend/node_modules/webpack/lib/util'

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: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
@ ./node_modules/webpack/lib/CleanPlugin.js 12:17-37
@ ./node_modules/webpack/lib/index.js 115:9-33
@ ./node_modules/dotenv-webpack/dist/index.js 12:15-33
@ ./node_modules/dotenv-webpack/browser.js 1:13-38
@ ./app/components/HomeGuest.js 5:15-40
@ ./app/Main.js 8:0-47 38:96-105

推荐答案

他们在webpack 5中删除了自动多面填充。我们必须自己添加它们。 更多信息here

这篇关于Webpack 5收到填充错误?!?!我的JavaScript Reaction项目在尝试编译我的webpack.config.js文件时收到PolyFill错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Webpack 5收到填充错误?!?!我的JavaScript Reaction项目在尝试编译我的webpack.config.js文件时收到PolyFill错误

基础教程推荐