How to clean React Native project

React Native evolving fast and everyday developer experiences going better but still have some problems.

How to clean React Native project

Have you ever been stuck randomly when you are building React Native project?

I mean it was working fine but you know you didn't change anything or you made some changes in dependencies and it starts to fail. Well it might happens, React Native project have many parts node_modules, Pods, Metro Bundler etc... Most commonly Metro Bundler crashing too much.

if you don't know where are the problems. It's time to clean your project and a fresh start to the project. you can manually clean your caches and build folders etc. but there is an easy way to do it.

This awesome package helps us to do it easily.

To install the package

yarn add -D react-native-clean-project

// or 

npm install --save-dev react-native-clean-project

After installing the package it will be detected as a  react-native command and you will have two options. auto and interactive. Auto cleans everything and it will be like fresh project.  but it will slow down your build time. Interactive helps you to choose which state you want to clean.

  • react-native clean-project-auto
  • react-native clean-project  

You can also add these options to your project package.json. It will help you to run easily and  memorize the command

// package.json

  "scripts": {
    "clean": "react-native clean-project",
    "clean:auto": "react-native clean-project-auto"