Exclude debug JavaScript code during minification

后端 未结 11 2025
庸人自扰
庸人自扰 2020-11-28 07:16

I\'m looking into different ways to minify my JavaScript code including the regular JSMin, Packer, and YUI solutions. I\'m really interested in the new Google Closure Compil

11条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 07:38

    I use this in my React apps:

    if (process.env.REACT_APP_STAGE === 'PROD')
      console.log = function no_console() {};
    

    In other words, console.log will return nothing on prod enviroment.

提交回复
热议问题