How to check if a create-react-app project has been ejected or not?

Viewed 1958

I'm working on a project built by someone else. I know it was bootstrapped by create-react-app because it says so in README.md.

However, I'm not sure if it has been ejected or not. There are many posts out there teaching you how to actually eject it, but I failed to find a way to check it in the first place. Any help is appreciated!

3 Answers

Some immediate giveaways that a create-react-app project has been ejected:

  • The dependencies field in package.json no longer contains react-scripts. Instead, it is populated with many additional packages like Babel, Eslint, Jess, Webpack and various Webpack loaders.
  • The absence of eject script.
  • The start, build and test no longer follows this format react-scripts start, react-scripts build etc.
  • A new directory named config appears.

Just sharing because you may or may not see all of these signs in your project as they were probably ejected a long time ago. I hope no one will spend two hours wondering why a certain package didn't work only to discover that the project has been ejected and the package only works with unejected ones.

Many thanks to @YuryTarabanko!

So I tried creating another project using CRA and ejecting it. Right after the ejection, a new directory called config popped up and there were some modifications in other directories, too.

Then I took a look at the project I'm actually interested in. The config directory is right there, with a structure similar to that config dir in the new project that popped up after the ejection. So I'm sure this project has been ejected, too!

Edit:

As Yuri pointed out in the comment:

The most noticeable difference IMHO would be the absence of eject command in package.json#scripts section though ;)

I somewhat agree with the script in package.json, but it could have easily been removed. If the project is in a repo, you should be able to look at the history of a few files to be certain.

Related