8

I have installed

npm i babel-plugin-transform-remove-console --save

Also added below code in .babelrc:

{
  "env": {
    "production": {
      "plugins": ["transform-remove-console"]
    }
  }
}

But in production mode, its not removing console.log.

Also in some sample project .babelrc file is not getting generated after doing npm installation.Am I missing anything?

Reference link

Anjana
  • 759
  • 2
  • 12
  • 33
  • Also having this issue. – Adamski May 22 '18 at 22:16
  • post your project. I have the same setting and it works fine. – fatfatson Jul 13 '18 at 02:01
  • 1
    I currently have this problem. I'm using react-native 0.60.3 and "babel-plugin-transform-remove-console": "^6.9.4" .... When I run ENVFILE=.env.production react-native run-android --variant=release I still see logs in the console. @adamski did you find a solution ? – T M Aug 28 '19 at 12:26
  • The answer to why it's not working for you guys is probably in this comment: "If you used create-react-app it might not be paying attention to your custom babel config, since it has all its own configs. You may need to eject the app in order to get this to work.". Found here: https://stackoverflow.com/questions/57224203/remove-console-log-statements-in-react-production-build – Christiaan Westerbeek Sep 06 '19 at 18:22

0 Answers0