webpack 4:默认配置
- entry 默认:
./src/index.js
(注意: 路径必须带上./
);entry: './src/index.js',
- output 默认最后路径:
./dist/main.js
(注意: 路径必须带上./
);
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js'
}
mode 默认:'production'
可选值:production、development、none
https://webpack.docschina.org/concepts/mode/
production:在生产环境开启压缩和优化,启用 FlagDependencyUsagePlugin, FlagIncludedChunksPlugin, ModuleConcatenationPlugin, NoEmitOnErrorsPlugin, OccurrenceOrderPlugin, SideEffectsFlagPlugin 和 UglifyJsPlugin。
development:启用 NamedChunksPlugin 和 NamedModulesPlugin。mode: 'production'
webpack 命令默认:
webpack
等价于webpack --config webpack.config.js
或webpack --config webpackfile.js