Start a personal dev blog on your domain for free with Hashnode and grow your readership.
Get Started

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

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

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/perfor..

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

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

Comments (3)

Chaim Lev-Ari's photo

Gr8 tip, but why is that related to react. I would change the title to js projects.

Adam Bene's photo

It is applicable for any Babel projects.

Chaim Lev-Ari's photo

@adambene ofcourse, that's what I was saying