Commit 4aa85ef3 authored by iamkun's avatar iamkun Committed by Zhi Cun

Build: Minimizing css and js for Element doc site (#14430)

* build: build css minimizing for production

* build: JS Minimizing For Production

* build: run only in production
parent 455265b9
...@@ -5,6 +5,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); ...@@ -5,6 +5,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin'); const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const md = require('markdown-it')(); const md = require('markdown-it')();
const slugify = require('transliteration').slugify; const slugify = require('transliteration').slugify;
...@@ -185,7 +187,10 @@ const webpackConfig = { ...@@ -185,7 +187,10 @@ const webpackConfig = {
} }
} }
}) })
] ],
optimization: {
minimizer: []
}
}; };
if (isProd) { if (isProd) {
...@@ -194,6 +199,14 @@ if (isProd) { ...@@ -194,6 +199,14 @@ if (isProd) {
filename: '[name].[contenthash:7].css' filename: '[name].[contenthash:7].css'
}) })
); );
webpackConfig.optimization.minimizer.push(
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: false
}),
new OptimizeCSSAssetsPlugin({})
);
} }
module.exports = webpackConfig; module.exports = webpackConfig;
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment