Chapter 5 discussion
One error is not going away, even with the instructions specified in the book. Specifically:
One of your dependencies, babel-preset-react-app, is importing the
"@babel/plugin-proposal-private-property-in-object" package without
declaring it in its dependencies. This is currently working because
"@babel/plugin-proposal-private-property-in-object" is already in your
node_modules folder for unrelated reasons, but it may break at any time.
babel-preset-react-app is part of the create-react-app project, which
is not maintianed anymore. It is thus unlikely that this bug will
ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
your devDependencies to work around this error. This will make this message
go away.
It looks like Create-react-app is dead - what are recommendations as to what to use instead? And is the author of the book going to update the materials to reflect this fact?
Also, got around this error by implementing the recommended change:
package.json
+ "devDependencies": {
+ "@babel/plugin-proposal-private-property-in-object":"*"
+ },
Follow-up questions - Do I put “*” for the latest version? Also, do I run “npm install” and “npm ci” after this change?
I’d specify the current version (7.21.11) so it doesn’t upgrade without your knowledge.
Just run npm install
, npm ci
is for when you don’t want the lock file to be changed (like on a server or during a ci run), in this case, lock file changes are fine
You are correct that create-react-app is not really maintained anymore. The authors haven’t officially replaced it or added deprecation notes to the website. The good news is, it still works to compile JSX and bundle things for running in the web browser, so it’s still a working tool for creating a client side website. Also, downloads for react-scripts (a dependency in your project used by create-react-app) haven’t changed much in the last 2 years: react-scripts | npm trends so it’s still pretty commonly used
The React site suggests a few frameworks: Start a New React Project – React but they are all fairly opinionated and require you to learn the framework as well as React concepts. The book was published around the same time create-react-app changes were happening, which is why this didn’t make it in the book, but since we wanted to focus on the basics of React, we’ve stuck with create-react-app for now
Thank you for the the explanation!