2021-08-14 21:00:33 +02:00
|
|
|
const { merge } = require('webpack-merge');
|
|
|
|
const common = require('./webpack.common.js');
|
|
|
|
const path = require('path');
|
|
|
|
const ZipPlugin = require('zip-webpack-plugin');
|
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2021-08-14 21:41:49 +02:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2021-08-14 21:00:33 +02:00
|
|
|
|
|
|
|
const version = require('./src/manifest.json').version;
|
2022-01-21 11:12:49 +01:00
|
|
|
const name = require('./src/locale/en_GB/messages.json').appName.message;
|
2021-08-14 21:00:33 +02:00
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
mode: 'production',
|
|
|
|
optimization: {
|
|
|
|
minimize: true,
|
|
|
|
minimizer: [
|
|
|
|
new CssMinimizerPlugin({
|
|
|
|
minify: CssMinimizerPlugin.cleanCssMinify
|
2021-08-14 21:41:49 +02:00
|
|
|
}),
|
|
|
|
new TerserPlugin({
|
2021-08-21 13:35:37 +02:00
|
|
|
terserOptions: {
|
|
|
|
format: {
|
|
|
|
comments: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
extractComments: false,
|
2021-08-14 21:00:33 +02:00
|
|
|
})
|
|
|
|
]
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.css$/i,
|
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
plugins: [
|
2021-08-21 13:35:37 +02:00
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].[contenthash].css'
|
|
|
|
}),
|
2021-08-14 21:00:33 +02:00
|
|
|
new ZipPlugin({
|
|
|
|
path: path.resolve(__dirname, 'dist/extension'),
|
|
|
|
filename: name + '_' + version + '.zip'
|
|
|
|
})
|
|
|
|
]
|
|
|
|
});
|