69 lines
1.4 KiB
JavaScript
69 lines
1.4 KiB
JavaScript
|
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",
|
||
|
},
|
||
|
});
|