Reputation: 1281
What is happening in the background after you execute the npm start command? Is it generating something like a web server so that your browser can communicate with?
Upvotes: 11
Views: 7702
Reputation: 5040
npm start in create-react-app is doing many things, and among those it uses webpack-dev-server to start a development server which you can communicate with.
If you are more interested in how it works you should try to run npm run eject
.
This will allow you to see what Create-React-App does since it places the scripts run by npm start directly in your application directory. It further add the webpack config files used by those scripts to your directory. Finally it updates your package.json file, such that you can actually see what dependencies Create-React-App is using (Among those you will find webpack-dev-server)
If you then look into package.json
and check out the "scripts" section you can start following what each command actually do. For instance the "start" command can be found here. This will call the start.js
file in your scripts folder. This is the file where you will see the webpack-dev-server being started.
In general you can check out the two folders scripts
and config
to learn about the details.
Upvotes: 14