Sign in
Log inSign up

Remove console.log statements in production in React / React Native apps

Adam Bene's photo
Adam Bene
·May 16, 2017

See post here: blog.benestudio.co/remove-console-log-stat…

Install babel plugin

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

Edit .babelrc

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

You are done.

console.log statements no longer cause performance issues nor flood the log in production.

Docs: facebook.github.io/react-native/docs/perfo…

PS: it works with any JavaScript projects that uses Babel!