How can I remove all console.log from production. This code isn't working on laravel-mix 4.x:
webpack.mix.js
mix
.js('resources/js/app.js', 'public/js')
if (mix.inProduction()) {
mix.options({
uglify: {
uglifyOptions: {
warnings: false,
comments: false,
beautify: false,
compress: {
drop_console: true,
}
}
}
});
mix.version();
}
With laravel-mix
4.x they replaced uglify
with terser
(Changelog). You have to change your webpack.mix.js:
if (mix.inProduction()) {
mix.options({
terser: {
terserOptions: {
compress: {
drop_console: true
}
}
}
});
mix.version();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With