- 长久化缓存
- 更好的算法和默认值改良长期缓存
- 更好的 tree shaking
- webpack 5 会移除所有废除的个性。为了无障碍的推动,应保障在构建时再无任何的废除正告。
- mode 必须
- node.js 10.13
- webpack-cli 降级到最新
- plugin 和 loader 降级到最新的可用版本
- optimization.hashedModuleIds: true ↦ optimization.moduleIds: 'hashed'
- optimization.namedChunks: true ↦ optimization.chunkIds: 'named'
- optimization.namedModules: true ↦ optimization.moduleIds: 'named'
- NamedModulesPlugin ↦ optimization.moduleIds: 'named'
- NamedChunksPlugin ↦ optimization.chunkIds: 'named'
- HashedModulesPlugin ↦ optimization.moduleIds: 'hashed'
- optimization.noEmitOnErrors: false ↦ optimization.emitOnErrors: true
- optimization.occurrenceOrder: true ↦ optimization: {chunkIds: 'total-size', moduleIds: 'size'}
- optimization.splitChunks.cacheGroups.vendors ↦ optimization.splitChunks.cacheGroups.defaultVendors
- Compilation.entries ↦ Compilation.entryDependencies
- serve ↦ serve 已被移除,举荐应用 DevServer
node: {
Buffer: false,
process: false
}