Skip to content

Commit 5f16e02

Browse files
sudo-suhasfrandiox
authored andcommitted
Switch to uglifyjs-webpack-plugin (vuejs-templates#1119)
1 parent e31eef9 commit 5f16e02

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The development server will run on port 8080 by default. If that port is already
3333
- Source maps
3434

3535
- `npm run build`: Production ready build.
36-
- JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
36+
- JavaScript minified with [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony).
3737
- HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
3838
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
3939
- Static assets compiled with version hashes for efficient long-term caching, and an auto-generated production `index.html` with proper URLs to these generated assets.

template/build/webpack.prod.conf.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
99
const HtmlWebpackPlugin = require('html-webpack-plugin')
1010
const ExtractTextPlugin = require('extract-text-webpack-plugin')
1111
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
1213

1314
const env = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'
1415
? require('../config/test.env')
@@ -34,10 +35,11 @@ const webpackConfig = merge(baseWebpackConfig, {
3435
new webpack.DefinePlugin({
3536
'process.env': env
3637
}),
37-
// UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify
38-
new webpack.optimize.UglifyJsPlugin({
39-
compress: {
40-
warnings: false
38+
new UglifyJsPlugin({
39+
uglifyOptions: {
40+
compress: {
41+
warnings: false
42+
}
4143
},
4244
sourceMap: config.build.productionSourceMap,
4345
parallel: true

template/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"optimize-css-assets-webpack-plugin": "^3.2.0",
9090
"ora": "^1.2.0",
9191
"rimraf": "^2.6.0",
92+
"uglifyjs-webpack-plugin": "^1.1.1",
9293
"url-loader": "^0.5.8",
9394
"vue-loader": "^13.3.0",
9495
"vue-style-loader": "^3.0.1",

0 commit comments

Comments
 (0)