Roots Discourse

Sage 9 — Remove console.log for build:production?

Hello there,

Does anyone know if there is a way to automatically remove all the console.log() from main.js after a yarn run build:production ?

Right now they are still here and it’s not looking very clean in F12 :slight_smile:

Maybe there are some existing configuration for webpack to do the trick ?

Many thanks,

Evan

1 Like

You shouldn’t commit code with console.log() is what I would suggest.

1 Like

I think you can add compress: {pure_funcs: [ 'console.log' ]} to your UglifyJS plugin in your webpack conf, although @kalenjohnson is definitely the best way to go :slight_smile:

2 Likes

Thank you. You made my day :slight_smile: