nightTab/webpack.prod.js

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-08-14 19:00:33 +00: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 19:41:49 +00:00
const TerserPlugin = require('terser-webpack-plugin');
2021-08-14 19:00:33 +00:00
const version = require('./src/manifest.json').version;
const name = require('./src/manifest.json').name;
module.exports = merge(common, {
mode: 'production',
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin({
minify: CssMinimizerPlugin.cleanCssMinify
2021-08-14 19:41:49 +00:00
}),
new TerserPlugin({
parallel: true,
extractComments: false
2021-08-14 19:00:33 +00:00
})
]
},
module: {
rules: [{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
}],
},
plugins: [
new MiniCssExtractPlugin(),
new ZipPlugin({
path: path.resolve(__dirname, 'dist/extension'),
filename: name + '_' + version + '.zip'
})
]
});