This project is me taking Create React App for a spin and ejecting to learn more about configuring the build
npm start
to run the app
CRA makes a decision on my behalf to use Yarn (because I have Yarn installed, otherwise it would use npm?) and will generate a yarn.lock
. But I can set a flag to choose npm as a package manager:
npx create-react-app config-react-testing --use-npm
The script also attempts initialize git and commit. That fails because of my gitconfig setup which suits me fine, I find it kinda rude that the script tries to automatically make a commit in my name. ๐คจ
Let's measure dependencies!
git ls-files package-lock.json | xargs wc -l
There are 38155 lines of code in the initial package-lock.json and it's 1.46 MB ๐คช
Running npm run eject
results in:
- 14 changed files with 1,936 additions and 6 deletions
- 58 new dependencies to replace the single react-scripts in package.json
- config/webpack.config.js that is too large a diff for github to render ๐
- Check out the whole commit
No changes to the lock file. At first I expected there would be, but makes sense when I think about it. Ejecting react-scripts doesn't change which packages are used in the project and installed in my node_modules โ the eject changes how they are referenced in package.json
When running eject, there is a warning and then if you insist anyway, an invitation to a survey. Nice! I get to answer questions around my experience with Create React App and questions like: โhow comfortable are you with configuring Webpack, Babel, and ESLint manually on your own?โ and
How do you feel after running
eject
?
I feel frustrated because I didnโt want to give up the defaults but I needed to change something
I feel empowered because I am comfortable with the underlying tools
Neither of those two. I feel curious and excited ๐ฅณ because I want to take responsibility and ownership of configuring a new application. Not always, but sometimes. I don't understand why CRA is trying so hard to persuade me against doing that. I'm sceptical of abstracting away too much in a magical react-scripts
that is a one-size-fits-all config, but equally unconvinced that ejecting is a path I want to take.