mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw-ui.git
synced 2025-10-29 09:52:31 +00:00
87 lines
2.2 KiB
JavaScript
87 lines
2.2 KiB
JavaScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
/* eslint-disable prefer-template */
|
|
const { merge } = require('webpack-merge');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
const path = require('path');
|
|
const paths = require('./paths');
|
|
const common = require('./webpack.common');
|
|
|
|
module.exports = merge(common, {
|
|
mode: 'production',
|
|
devtool: false,
|
|
output: {
|
|
path: paths.build,
|
|
publicPath: '/',
|
|
filename: 'js/[name].[contenthash].bundle.js',
|
|
},
|
|
plugins: [
|
|
// new BundleAnalyzerPlugin(),
|
|
new MiniCssExtractPlugin({
|
|
filename: 'styles/[name].[contenthash].css',
|
|
chunkFilename: '[contenthash].css',
|
|
}),
|
|
new CompressionPlugin({
|
|
filename: '[path]/[name].gz[query]',
|
|
algorithm: 'gzip',
|
|
test: /\.js$|\.css$|\.html$|\.eot?.+$|\.ttf?.+$|\.woff?.+$|\.svg?.+$/,
|
|
threshold: 10240,
|
|
minRatio: 0.8,
|
|
}),
|
|
],
|
|
module: {
|
|
rules: [],
|
|
},
|
|
optimization: {
|
|
minimize: true,
|
|
minimizer: [
|
|
'...',
|
|
new TerserPlugin({
|
|
terserOptions: {
|
|
warnings: false,
|
|
compress: {
|
|
comparisons: false,
|
|
},
|
|
parse: {},
|
|
mangle: true,
|
|
output: {
|
|
ascii_only: true,
|
|
},
|
|
},
|
|
parallel: true,
|
|
}),
|
|
new CssMinimizerPlugin(),
|
|
],
|
|
nodeEnv: 'production',
|
|
sideEffects: true,
|
|
runtimeChunk: 'single',
|
|
splitChunks: {
|
|
chunks: 'all',
|
|
maxInitialRequests: 10,
|
|
minSize: 0,
|
|
cacheGroups: {
|
|
vendor: {
|
|
test: /[\\/]node_modules[\\/]/,
|
|
name(module) {
|
|
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
|
|
return `npm.${packageName.replace('@', '')}`;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
modules: [],
|
|
alias: {
|
|
graphlib: path.resolve(__dirname, '../', 'node_modules', 'graphlib'),
|
|
},
|
|
},
|
|
performance: {
|
|
hints: false,
|
|
maxEntrypointSize: 512000,
|
|
maxAssetSize: 512000,
|
|
},
|
|
});
|