How to Remove console.log from Production in React Native?

Oct 28, 2022 . Admin

This post is focused on disable console.log in production react native. if you want to see example of remove console.log in production react native then you are a right place. I explained simply step by step react native remove console log. I would like to share with you babel plugin transform remove console. you will do the following things for babel plugin transform remove console npm./p>

There are libraries such as redux logger which uses console.log. Manually removing console.log is not easy. Luckily, there’s a simple way to remove console.log from production with little effort.

Step 1: Download Project

In the first step run the following command to create a project.

expo init ExampleApp
Step 2: Install Library

The babel-plugin-transform-remove-console babel plugin helps you to remove all console.* calls. Install the library using the following command.

npm install babel-plugin-transform-remove-console --save-dev

Create a file named .babelrc in your project folder. Then add the following configuration.

{
  "env": {
    "production": {
      "plugins": ["transform-remove-console"]
    }
  }
}
Step 3: Run Project

In the last step run your project using the below command.

expo start

You can QR code scan in Expo Go Application on mobile.

It will help you...

#React Native