Update dependencies and improve build system
This commit is contained in:
40
service/config/prod.js
Normal file
40
service/config/prod.js
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict'
|
||||
|
||||
const { merge } = require('webpack-merge')
|
||||
const TerserPlugin = require('terser-webpack-plugin')
|
||||
|
||||
const baseWebpackConfig = require('./base')
|
||||
const cssWebpackConfig = require('./css')
|
||||
const config = require('../project.config')
|
||||
const terserOptions = require('./terserOptions')
|
||||
|
||||
module.exports = merge(baseWebpackConfig, cssWebpackConfig, {
|
||||
mode: 'production',
|
||||
|
||||
output: {
|
||||
publicPath: config.build.publicPath,
|
||||
},
|
||||
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [new TerserPlugin(terserOptions())],
|
||||
moduleIds: 'deterministic',
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
defaultVendors: {
|
||||
name: `chunk-vendors`,
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: -10,
|
||||
chunks: 'initial',
|
||||
},
|
||||
common: {
|
||||
name: `chunk-common`,
|
||||
minChunks: 2,
|
||||
priority: -20,
|
||||
chunks: 'initial',
|
||||
reuseExistingChunk: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user