So webpack 4 added a mode option. And it’s required. (Actually it’s not required but it will warn you if you omit it.)

webpack 4 now ships with two sets of defaults. development and production . These are the two values to which mode can be set to.

The development defaults will give you the best* development experience focusing on:

Tooling for in browser debugging

Fast incremental compilation for a fast development cycle

Useful error messages at runtime

(* Actually this depends on your use case, we try to cover the most common one here)

While the production defaults will give you a set of defaults useful for deploying your application, focusing on:

Small output size

Fast code at runtime

Omitting development-only code

Not exposing source code or file paths

Easy to use output assets