laravel-mix: Webpack polyfill error
- Laravel Mix Version: laravel-mix@6.0.18
- Node Version: v14.15.4
- NPM Version: 6.14.10
- OS: macOS Big Sur
Description:
When i’m running yarn run development i get a whole bunch of errors. mainly the following error
“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.”
See screenshot:

What i’ve tried already:
- added
mix.options({ legacyNodePolyfills: true });to my webpack.mix.js file - added
mix.webpackConfig({ resolve: { fallback: { process: require("node-libs-browser").process, buffer: require("node-libs-browser").buffer, }, }, })
unfortunately non of them worked…
Someone knows what to do about this?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 21
From one day to another, I now get 200+ Webpack polyfill errors in one project. Other projects with Laravel Mix work fine. This is really strange…
Edit: I had an
import { options } from "laravel-mix";in my code. That was the issue for me.I don’t know how i placed this code but I had to remove in one of my scripts
Same issue here. I use the “Auto Import - ES6, TS, JSX, TSX” extension in VScode. It added this line in one of the react jsx files:
import { react } from “laravel-mix”;
Here’s what I did:
Add this to webpack.mix.conf:
Still getting errors (just different ones now)…