Setting up webpack

To run the React application, we need to install webpack 4 (while writing this book, the current stable version of webpack is version 4) and webpack CLI as devDependencies. Let's get started:

  1. Install these packages from npm using the following command:
npm install --save-dev webpack webpack-cli
  1. The next step is to include these packages inside the package.json file and have them run in our start and build scripts. To do this, add the start and build scripts to our package.json file:
{    "name": "movieList",    "version": "1.0.0",    "description": "",    "main": "index.js",    "scripts": {_       "start": "webpack --mode development",+       "build": "webpack --mode production",        "test": "echo \"Error: no test specified\" && exit 1"    }, "keywords": ...

Get React Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.