Accepted answer

since you are using react, my guess is you are already using babel. there's a plugin for that purpose. it's called babel-plugin-transform-remove-console. this will exclude all console.log's statement during the build process.
install that in your app and configure it via .babelrc as follows:

  "plugins": ["transform-remove-console"]

you can also specify the variant(s) of the console functions to exclude:

  "plugins": [ ["transform-remove-console", { "exclude": [ "error", "warn"] }] ]

my advise is to not use console logs in your code except necessary.


in my app.js i have the following code for accomplishing this:

import { yellowbox } from 'react-native';

componentdidmount() {
    // the following lines are a workaround
    // in order to stop getting warnings about timer
    // see:
    yellowbox.ignorewarnings(['setting a timer']);
    const _console = _.clone(console);
    console.warn = message => {
      if (message.indexof('setting a timer') <= -1) {

Related Query

More Query from same tag