
Running webpack
The last step is adding scripts to our package.json file so that we can actually run our application via npm start.
Open package.json and find the scripts section, and replace it with the following:
"scripts": {
"start": "webpack-dev-server",
"build": "webpack"
},
Finally, we can run our project by executing the following command:
npm start
Then open http://localhost:8080/ in your browser. Open the Console to see the following hello world! message:

Later, when setting up a production environment, you might want to rename the current start script to start:dev and define the start script as follows:
"scripts": {
"start": "npm build && serve dist",
"start:dev": "webpack-dev-server",
"build": "webpack"
},
npm install --save serve.
Note that for all custom scripts (such as start:dev), you will need to run npm run start:dev instead of just npm start:dev.
If we need to have some server-side code, for example, to implement server-side rendering, the serve tool can be replaced with a custom web server. Server-side rendering will be covered in Chapter 10, Rendering on the Server.