-
entry: "string" or "mapping", if using mapping, multiple chunks will be produced.
-
output: Specify "output location", "output filename", "output format (esm, cjs, umd, etc.)", "clear previous output (e.g. dist) before outputting", etc.
-
mode: Specify the environment,
development
orproduction
. -
devtool: Whether to generate sourcemap.
-
resolve: Specify file path, extensions, aliases;
-
module: Specify loader(s)
- test: Specify filename, string or RegExp
- exclude: Exclude files
- use: Specify loader, string or object (can carry options parameter)
-
optimization: Specify whether to directly tree-shaking (sideEffects), and the degree of compression (minimize).
-
webpack.config.js: Can directly output an object or a function (receives env parameter).
- To generate declaration files only without compiling, you can:
- outDir: Specify output location
- declaration: Whether to generate .d.ts files
- declarationDir: Specify .d.ts files output location
- declarationMap: Whether to generate .d.ts.map
- emitDeclarationOnly: Whether to generate declaration files only without compiling.