Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide warnings in Laravel mix

When I run npm run dev or npm run prod I get a un-scrollable amount of warnings in my terminal. How can I hide these warnings so they will not be printed to the terminal output? I am using Laravel 7.30.4, Node v15.0.1 and npm 7.0.3.

un-scrollable amount of warnings

Thank you in advance for any help!

like image 661
Hasanta Avatar asked Dec 13 '25 02:12

Hasanta


1 Answers

By default, Laravel Mix will display a system notification for each compilation. That way, you can quickly see if you have any errors that need addressing. However, in certain circumstances, this is undesirable (such as compiling on your production server). If this happens to be the case, they can be disabled from your webpack.mix.js file.

mix.disableNotifications();

Maybe you only want to be notified if there are any errors? That is possible too, by only disabling the success notifications. Please note that this is intended to be used via the watch command. The first compilation always displays a success notification. Only subsequent success notifications are disabled.

mix.disableSuccessNotifications();

and you can add this following to your mix configuration base on this webpack documentation.

mix.webpackConfig({
     stats: {
         warnings: false,
     }
 });
like image 149
Farid Vatani Avatar answered Dec 14 '25 16:12

Farid Vatani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!