react-scripts is a set of scripts in the create-react-app starter package; create-react-app can start the project without configuration; react-scripts start can set up the development environment and start the server, as well as hot Module reloaded.
The operating environment of this article: Windows 7 system, react17.0.1 version, Dell G3 computer.
What is react-scripts?
react-scripts is a set of scripts in the create-react-app starter package. create-react-app helps you start your project without configuration, so you don't have to set up the project yourself.
react-scripts start sets up the development environment and starts the server, as well as hot module reloading. You can read here to find out what it can do for you.
With create-react-app, you can use the following features immediately.
React, JSX, ES6 and Flow syntax support.
Languages other than ES6, such as the object spread operator.
Auto-prefixed CSS so you don't need -webkit- or other prefixes.
Fast interactive unit test runner with built-in support for coverage reporting.
The real-time development server warns about common errors.
A build script for bundling JS, CSS and images with hashes and source maps for production.
Checklist of offline-first service workers and web applications that meet all Progressive Web Application criteria.
Easily update the above tools with a single dependency.
npm script
npm start is the shortcut of npm run start.
npm run is used to run the script you define in the scriptspackage.json object
If there is no key in the start script object, it defaults to node server.js
Sometimes you Want to do something beyond what react scripts can offer, in which case you can do react-scripts eject. This converts your project from a "managed" state to an unmanaged state, where you have full control over dependencies, build scripts, and other configurations.
Recommended learning: "react video tutorial"
The above is the detailed content of what is react-scripts. For more information, please follow other related articles on the PHP Chinese website!