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'); const TerserPlugin = require('terser-webpack-plugin'); 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 }), new TerserPlugin({ parallel: true, extractComments: false }) ] }, 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' }) ] });