badguardhome/client2/scripts/webpack/webpack.config.prod.js
Eugene Burkov 5e20ac7ed5 Pull request: beta client squashed
Merge in DNS/adguard-home from beta-client-2 to master

Squashed commit of the following:

commit b2640cc49a6c5484d730b534dcf5a8013d7fa478
Merge: 659def862 aef4659e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Dec 29 19:23:09 2020 +0300

    Merge branch 'master' into beta-client-2

commit 659def8626467949c35b7a6a0c99ffafb07b4385
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Dec 29 17:25:14 2020 +0300

    all: upgrade github actions node version

commit b4b8cf8dd75672e9155da5d111ac66e8f5ba1535
Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com>
Date:   Tue Dec 29 16:57:14 2020 +0300

    all: beta client squashed
2020-12-29 19:53:56 +03:00

92 lines
2.9 KiB
JavaScript

const path = require('path');
const { merge } = require('webpack-merge');
const baseConfig = require('./webpack.config.base');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserJSPlugin = require('terser-webpack-plugin');
const Webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = merge(baseConfig, {
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, '../../../build2/static'),
filename: '[name].bundle.[hash:5].js',
publicPath: '/'
},
optimization: {
minimizer: [new TerserJSPlugin({terserOptions: {
output: {
comments: false,
},
},
extractComments: false,
}), new OptimizeCSSAssetsPlugin({})],
splitChunks: {
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
},
},
},
},
module: {
rules: [
{
test: (resource) => {
return (
resource.indexOf('.pcss')+1
|| resource.indexOf('.css')+1
|| resource.indexOf('.less')+1
) && !(resource.indexOf('.module.')+1);
},
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
esModules: true,
}
}, 'css-loader', 'postcss-loader', {
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
}],
exclude: /node_modules/,
},
{
test: /\.module\.p?css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
esModules: true,
}
},
{
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
},
},
'postcss-loader',
],
exclude: /node_modules/,
}
]
},
plugins: [
new Webpack.DefinePlugin({
DEV: false,
}),
new MiniCssExtractPlugin({
filename: '[name].[hash:5].css',
}),
]
});