UNPKG

infra-cli

Version:
43 lines (39 loc) 1.06 kB
import TerserPlugin from 'terser-webpack-plugin' import SpeedMeasurePlugin from 'speed-measure-webpack-plugin' import { merge } from 'webpack-merge' import baseConfig from './webpack.config.base.babel' const smp = new SpeedMeasurePlugin() export default (env = {}, argv) => { return smp.wrap( merge(baseConfig(env, argv), { optimization: { minimizer: [ new TerserPlugin({ parallel: true, sourceMap: true, cache: true }) ], runtimeChunk: { name: 'runtime' }, splitChunks: { chunks: 'all', minChunks: 1, maxAsyncRequests: 6, maxInitialRequests: 5, automaticNameDelimiter: '~', cacheGroups: { baseCommon: { name: 'baseCommon', chunks: 'all', test: /[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom)[\\/]/, priority: -10 } } } }, plugins: [] }) ) }