Skip to content

Commit c408224

Browse files
sudo-suhasLinusBorg
authored andcommitted
Switch to uglifyjs-webpack-plugin (#1119)
1 parent b4da89c commit c408224

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The development server will run on port 8080 by default. If that port is already
4141
- Source maps
4242

4343
- `npm run build`: Production ready build.
44-
- JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
44+
- JavaScript minified with [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony).
4545
- HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
4646
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
4747
- 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.

docs/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ All build commands are executed via [NPM Scripts](https://docs.npmjs.com/misc/sc
1616

1717
> Build assets for production. See [Integrating with Backend Framework](backend.md) for more details.
1818
19-
- JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
19+
- JavaScript minified with [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony).
2020
- HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
2121
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
2222
- All static assets compiled with version hashes for efficient long-term caching, and a production `index.html` is auto-generated with proper URLs to these generated assets.

template/build/webpack.prod.conf.js

Lines changed: 6 additions & 4 deletions
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')
@@ -33,10 +34,11 @@ const webpackConfig = merge(baseWebpackConfig, {
3334
new webpack.DefinePlugin({
3435
'process.env': env
3536
}),
36-
// UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify
37-
new webpack.optimize.UglifyJsPlugin({
38-
compress: {
39-
warnings: false
37+
new UglifyJsPlugin({
38+
uglifyOptions: {
39+
compress: {
40+
warnings: false
41+
}
4042
},
4143
sourceMap: config.build.productionSourceMap,
4244
parallel: true

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"optimize-css-assets-webpack-plugin": "^3.2.0",
108108
"ora": "^1.2.0",
109109
"rimraf": "^2.6.0",
110+
"uglifyjs-webpack-plugin": "^1.1.1",
110111
"url-loader": "^0.5.8",
111112
"vue-loader": "^13.3.0",
112113
"vue-style-loader": "^3.0.1",

0 commit comments

Comments
 (0)