Skip to content

Switch to uglifyjs-webpack-plugin #1119

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 1 commit into from
Dec 2, 2017
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 @@ -41,7 +41,7 @@ The development server will run on port 8080 by default. If that port is already
- 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).
- 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.
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
10 changes: 6 additions & 4 deletions template/build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

const env = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'
? require('../config/test.env')
Expand All @@ -33,10 +34,11 @@ const webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({
'process.env': env
}),
// UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com./babel/minify
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
Expand Down
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"rimraf": "^2.6.0",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
Expand Down