Originally Published: 2020-12-01
if you ever feel like aren't a good webdev you can just go to ostensibly professional large scale consumer production websites and just open up the console and look at shit like this pic.twitter.com/BwLftTvyVy— Nicole He (@nicolehe) November 29, 2020
It’s easy! Just pass
drop_console = true into your Webpack’s “Terser” configuration (what Webpack uses for minification), and console output should be stripped from all your Webpacker assets.
As it turns out, other people have also found this confusing, and a helpful GitHub issue comment has the solution:
config/webpack/production.js, after the
const environment line simply add the following:
Commit, reload, and enjoy the amazing freedom of using
console.log in development without worrying about it leaking into production.