How to hide warnings in Laravel mix

Viewed 2061

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!

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,
     }
 });
Related