How to do it...

We will first add the Webpack Dev Server:

  1. Once you installed the webpack-dev-server dependency, we need to add a new script to start the application in our package.json:
    "scripts": {      "start": "webpack-dev-server --mode development --open",      "build-development": "webpack --mode development",      "build": "webpack --mode production"    }
File: package.json
  1. As you know, the --mode flag specifies the mode we want (the default is production), and the --open flag opens the browser when we start the application. Now you can run the application with the npm start command:
  1. Your application was opened using port 8080, which is the default ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.