Skip to content

Switch to uglifyjs-webpack-plugin #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ See ["Configuring your Web server to prevent caching"](docs/prevent_caching.md)
- Source maps

- `npm run build`: Production ready build.
- JavaScript minified with [UglifyJS](https://github.com./mishoo/UglifyJS2).
- JavaScript minified with [UglifyJS v3](https://github.com./mishoo/UglifyJS2/tree/harmony).
- HTML minified with [html-minifier](https://github.com./kangax/html-minifier).
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com./ben-eb/cssnano).
- 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.
Expand Down
2 changes: 1 addition & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ All build commands are executed via [NPM Scripts](https://docs.npmjs.com/misc/sc

> Build assets for production. See [Integrating with Backend Framework](backend.md) for more details.

- JavaScript minified with [UglifyJS](https://github.com./mishoo/UglifyJS2).
- JavaScript minified with [UglifyJS v3](https://github.com./mishoo/UglifyJS2/tree/harmony).
- HTML minified with [html-minifier](https://github.com./kangax/html-minifier).
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com./ben-eb/cssnano).
- 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.
Expand Down
12 changes: 8 additions & 4 deletions template/build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const loadMinified = require('./load-minified')

const env = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'
Expand All @@ -36,11 +37,14 @@ const webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({
'process.env': env
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: true
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
Expand Down
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.3.0",
"rimraf": "^2.6.2",
"uglifyjs-webpack-plugin": "^1.1.2",
"url-loader": "^0.6.2",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.3",
Expand Down