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 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.