What Does Eject do in Create React App?

Shai UI picture Shai UI · Apr 9, 2018 · Viewed 13.7k times · Source

I think it has something to do with using webpack directly and therefore gives more flexibility. But I'm not completely sure if someone can explain what "ejecting" means. Also what are the ramifications of ejecting a create react app? Is it bad to do this, or?

Answer

Tomasz Mularczyk picture Tomasz Mularczyk · Apr 9, 2018

To bootstrap a react project it will require for you to know about things like Webpack or Babel which might be a sticking point for people who do not want to learn about these.

create-react-app provides a fully configured environment with reasonable defaults (and possible to extend). Most infrastructure-related work is hidden from you, and whenever there are changes in one of the dependent packages this is taken care of for you -- it will only be required to update react-scripts.

I highly recommend this presentation by one of CRA authors it will give you a better idea of the project.

Now eject means that all of the configuration will be exposed to you. You will see every package which runs your project. Now you are responsible for maintaining all of that configuration.

This is not necessarily a bad thing; you are then left with more code to maintain, but you get full control in return.