Skip to content

Commit 694af84

Browse files
authored
Merge pull request #128 from sudo-suhas/uglifyjs-plugin
Switch to uglifyjs-webpack-plugin
2 parents d03f096 + 5da8acc commit 694af84

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ See ["Configuring your Web server to prevent caching"](docs/prevent_caching.md)
4646
- Source maps
4747

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

docs/commands.md

+1-1
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

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
1212
const ExtractTextPlugin = require('extract-text-webpack-plugin')
1313
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
1414
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
15+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
1516
const loadMinified = require('./load-minified')
1617

1718
const env = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'
@@ -36,11 +37,14 @@ const webpackConfig = merge(baseWebpackConfig, {
3637
new webpack.DefinePlugin({
3738
'process.env': env
3839
}),
39-
new webpack.optimize.UglifyJsPlugin({
40-
compress: {
41-
warnings: false
40+
new UglifyJsPlugin({
41+
uglifyOptions: {
42+
compress: {
43+
warnings: false
44+
}
4245
},
43-
sourceMap: true
46+
sourceMap: config.build.productionSourceMap,
47+
parallel: true
4448
}),
4549
// extract css into its own file
4650
new ExtractTextPlugin({

template/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"optimize-css-assets-webpack-plugin": "^3.2.0",
9191
"ora": "^1.3.0",
9292
"rimraf": "^2.6.2",
93+
"uglifyjs-webpack-plugin": "^1.1.2",
9394
"url-loader": "^0.6.2",
9495
"vue-loader": "^13.3.0",
9596
"vue-style-loader": "^3.0.3",

0 commit comments

Comments
 (0)