How it works...

Webpack 4 has two modes: production and development. In Webpack 3, you needed to create a config file for each one; now you can get the same result just with a single line. Let's add a script to get our application to start using the development mode:

  {    "name": "webpack-zero-configuration",    "version": "1.0.0",    "description": "Webpack 4 Zero Configuration",    "main": "index.js",    "scripts": {      "build-development": "webpack --mode development",      "build": "webpack --mode production"    },    "author": "Carlos Santana",    "license": "MIT",    "devDependencies": {      "webpack": "^4.6.0",      "webpack-cli": "^2.0.15"    }  }
File: package.json

If you run the npm run build-development command, now you will see that the bundle is not compressed at all:

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.