替换压缩插件

This commit is contained in:
smallwei 2018-02-18 20:58:20 +08:00
parent 5093a23568
commit c12463b283
2 changed files with 10 additions and 6 deletions

View File

@ -8,11 +8,11 @@ var CopyWebpackPlugin = require('copy-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin')
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
var UglifyJsPlugin = require('uglifyjs-webpack-plugin')
var env = config.build.env var env = config.build.env
function resolveApp(relativePath) { function resolveApp(relativePath) {
return path.resolve(relativePath); return path.resolve(relativePath);
} }
var webpackConfig = merge(baseWebpackConfig, { var webpackConfig = merge(baseWebpackConfig, {
@ -33,11 +33,14 @@ var webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': env 'process.env': env
}), }),
new webpack.optimize.UglifyJsPlugin({ new UglifyJsPlugin({
compress: { uglifyOptions: {
warnings: false compress: {
warnings: false
}
}, },
sourceMap: true sourceMap: config.build.productionSourceMap,
parallel: true
}), }),
// extract css into its own file // extract css into its own file
new ExtractTextPlugin({ new ExtractTextPlugin({

View File

@ -58,6 +58,7 @@
"semver": "5.4.1", "semver": "5.4.1",
"shelljs": "0.7.8", "shelljs": "0.7.8",
"svg-sprite-loader": "3.4.1", "svg-sprite-loader": "3.4.1",
"uglifyjs-webpack-plugin": "^1.2.0",
"url-loader": "0.6.1", "url-loader": "0.6.1",
"vue-loader": "13.5.0", "vue-loader": "13.5.0",
"vue-style-loader": "3.0.3", "vue-style-loader": "3.0.3",