Webpack Configurations
https://webpack.js.org/configuration/
Table of Contents
mode
- Build webpack for development
- Development vs Production
dependencies
vsdevDependencies
inpackage.json
Entrypoint size exeeds the recommened limit (250kB)
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.
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.