Archived
0
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
website/webpack.analyze.js

69 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-07-13 05:03:28 +00:00
const { merge } = require("webpack-merge");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'production',
plugins: [
new CspHtmlWebpackPlugin({
'script-src': '',
'style-src': '',
}, {
hashingMethod: 'sha512',
}),
new MiniCssExtractPlugin({
filename: '[name].[chunkhash].css',
}),
],
module: {
rules: [
{
test: /\.[cs][ac]ss$/,
exclude: /node_modules/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
enforce: true,
},
js: {
test: /\.js$/,
name: 'js',
chunks: 'all',
enforce: true,
},
styles: {
test: /\.css$/,
name: 'styles',
chunks: 'all',
enforce: true,
},
},
},
runtimeChunk: true,
moduleIds: 'deterministic',
removeAvailableModules: true,
removeEmptyChunks: true,
usedExports: true,
innerGraph: true,
concatenateModules: true,
mergeDuplicateChunks: true,
portableRecords: true,
sideEffects: false,
flagIncludedChunks: true,
chunkIds: "deterministic",
realContentHash: true,
providedExports: true,
emitOnErrors: true,
mangleExports: "deterministic",
},
});