Create react app and git

create-react-app installs lots of packages other than mandatory react package to make development easier. Package.json only covers mandatory react packages.

What is the best way to preserve all the functionalities of create-react-app across systems using git?

For eg : eslint has to be configured, hot reloading doesn’t work.

I’m not sure what you’re asking here: with a create-react-app project, if it is a tracked as a git project, and you or another user pulls it down, then they or you just npm install then run it as normal, everything is there. If there are custom eslint rules that you have added, then you would just be save them in the project, as with any other files tracked by git. The custom eslint rules already used by CRA are there anyway, so if the project is tracked by git then they are also tracked. Hot reloading etc will just work, because it’s the exact same set of node modules, as specified in the package.json.

Edit: I think I understand why you’re confused:

No, the CRA package.json contains everything that’s needed for development, CRA doesn’t do anything special w/r/t that, that’s how you can install CRA and run it and have all those development tools. You’re ignoring the entry react-scripts in the package.json, it’s quite important, as it’s a package that contains everything you need for the development environment that comes with CRA.

Absolutely! I guess I had some other local problem. I just cloned repo again and everything was fine.

1 Like