smartcoder's avatar

How to display errors on the screen on Laravel Mix?

Now only display in the console and in the browser console, which is not very convenient for development. How can you display these errors directly on the browser screen?

Laravel Mix Version: 6.0.6

@babel/[email protected]
├── @pmmmwh/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Node Version (node -v): 17.0.1

NPM Version (npm -v): 8.1.0

OS: mac OS

0 likes
10 replies
smartcoder's avatar

@martinbean when i run react-scripts start, I can display errors on browser screen, i'm sure that i can do it for the mix, I've already dug up the entire Internet

smartcoder's avatar

@Sinnbeck because i have white screen and nothing changes

mix.webpackConfig({
    // stats: 'normal',
    devtool: 'cheap-module-source-map',
    plugins: [new ErrorOverlayPlugin()],
})
smartcoder's avatar

I deliberately made the mistake of the unknown variable oops, ibb.co/MPVJRs3

smartcoder's avatar

Have an idea with static getDerivedStateFromError(error) {} in React App, it works of course, but maybe there is another solution?

smartcoder's avatar
smartcoder
OP
Best Answer
Level 1

In the end, I solved the problem with installing a clean application npx create-react-app, and replace react-scripts to package react-app-rewired, it solved the problem

Please or to participate in this conversation.