Duplicate CSS + Compression (#1071)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-03-01 10:31:47 +07:00
committed by GitHub
parent b1aa6c1132
commit 5435c4162d
5 changed files with 72 additions and 36 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "1.0.1",
"license": "EPL-2.0",
"scripts": {
"build": "cross-env NODE_ENV=production webpack --stats-error-details && echo 'done'",
"build": "rm -rf ./dist && cross-env NODE_ENV=production webpack --stats-error-details && echo 'done'",
"analyze": "cross-env NODE_ENV=production webpack --json > stats.json",
"show": "webpack-bundle-analyzer stats.json dist",
"dev": "cross-env CLIENT_TYPE=dev webpack serve",
+8 -6
View File
@@ -44,7 +44,7 @@ module.exports = {
output: {
path: __dirname + '/dist',
filename: '[name].js',
chunkFilename: '[name].[id].js',
chunkFilename: '[name].[id][contenthash].js',
publicPath: '/'
},
module: {
@@ -101,7 +101,8 @@ module.exports = {
{
test: /\.css$/,
use: [
prod ? MiniCssExtractPlugin.loader : 'style-loader',
// prod ? MiniCssExtractPlugin.loader :
'style-loader',
'css-loader',
'postcss-loader'
]
@@ -110,7 +111,8 @@ module.exports = {
{
test: /\.scss$/,
use: [
prod ? MiniCssExtractPlugin.loader : 'style-loader',
// prod ? MiniCssExtractPlugin.loader :
'style-loader',
'css-loader',
'postcss-loader',
'sass-loader',
@@ -165,9 +167,9 @@ module.exports = {
mode,
plugins: [
...(prod ? [new CompressionPlugin()] : []),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
// new MiniCssExtractPlugin({
// filename: '[name].[id][contenthash].css'
// }),
new Dotenv({path: prod ? '.env-prod' : '.env'}),
new DefinePlugin({
'process.env.CLIENT_TYPE': JSON.stringify(process.env.CLIENT_TYPE)