2020-06-05 16:01:06 +00:00
|
|
|
process.env.NODE_ENV = 'production';
|
|
|
|
|
2022-03-25 10:42:39 +00:00
|
|
|
const {merge} = require('webpack-merge');
|
2020-02-06 15:43:07 +00:00
|
|
|
const common = require('./webpack.common.js');
|
|
|
|
|
2021-05-12 22:32:04 +00:00
|
|
|
//const CompressionPlugin = require("compression-webpack-plugin");
|
|
|
|
//const TerserJSPlugin = require('terser-webpack-plugin');
|
|
|
|
//const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
2020-02-06 15:43:07 +00:00
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
mode: 'production',
|
|
|
|
|
2021-04-16 18:04:15 +00:00
|
|
|
devtool: 'source-map',
|
|
|
|
|
2020-02-06 15:43:07 +00:00
|
|
|
optimization: {
|
2020-06-13 08:19:39 +00:00
|
|
|
//minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})],
|
2020-02-17 12:18:06 +00:00
|
|
|
//runtimeChunk: 'single',
|
2020-02-06 15:43:07 +00:00
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all',
|
|
|
|
maxInitialRequests: Infinity,
|
|
|
|
//minSize: 0,
|
|
|
|
cacheGroups: {
|
|
|
|
vendor: {
|
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
|
name(module) {
|
|
|
|
// get the name. E.g. node_modules/packageName/not/this/part.js
|
|
|
|
// or node_modules/packageName
|
|
|
|
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
|
|
|
|
|
|
|
|
// npm package names are URL-safe, but some servers don't like @ symbols
|
|
|
|
return `npm.${packageName.replace('@', '')}`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2021-05-12 22:32:04 +00:00
|
|
|
/* new CompressionPlugin({
|
2020-02-06 15:43:07 +00:00
|
|
|
filename: '[path].gz[query]',
|
|
|
|
algorithm: 'gzip',
|
|
|
|
test: /\.(js|css|html|svg)$/,
|
|
|
|
threshold: 10240,
|
|
|
|
minRatio: 0.8,
|
2021-05-12 22:32:04 +00:00
|
|
|
}), */
|
2020-02-06 15:43:07 +00:00
|
|
|
/* new CompressionPlugin({
|
|
|
|
filename: '[path].br[query]',
|
|
|
|
algorithm: 'brotliCompress',
|
|
|
|
test: /\.(js|css|html|svg)$/,
|
|
|
|
compressionOptions: { level: 11 },
|
|
|
|
threshold: 10240,
|
|
|
|
minRatio: 0.8,
|
|
|
|
deleteOriginalAssets: false,
|
|
|
|
}), */
|
|
|
|
]
|
|
|
|
});
|