Webpack Configurations

https://webpack.js.org/configuration/

Table of Contents

mode reference

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

# Overrides "mode" field in config
webpack --mode production

Build webpack for development howto

For ease of use, put commands in package.json:

    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1",
+     "watch": "webpack --watch",
      "build": "webpack"
    },

Or,

    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1",
      "watch": "webpack --watch",
+     "start": "webpack-dev-server --open",
      "build": "webpack"
    },

Development vs Production discussion

dependencies vs devDependencies in package.json discussion

Theoretically speaking, Since a webpack project builds a kind of package as a product, all dependencies required to build the project must be installed as dependencies, not devDependencies.

Entrypoint size exeeds the recommened limit (250kB) discussion

The warning is pretty much explanatory. But you can turn it off by adding performance: { hints: false } to your webpack config.