diff --git a/lib/builder/webpack/client.config.js b/lib/builder/webpack/client.config.js index 62982ebc51..1136db3513 100644 --- a/lib/builder/webpack/client.config.js +++ b/lib/builder/webpack/client.config.js @@ -5,6 +5,7 @@ import HTMLPlugin from 'html-webpack-plugin' import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin' import ProgressBarPlugin from 'progress-bar-webpack-plugin' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' +import MinifyPlugin from 'babel-minify-webpack-plugin' import { resolve } from 'path' import base from './base.config.js' @@ -158,9 +159,17 @@ export default function webpackClientConfig () { config.plugins.push(new webpack.HashedModuleIdsPlugin()) // Minify JS + + // https://github.com/webpack-contrib/babel-minify-webpack-plugin + config.plugins.push(new MinifyPlugin()) + + // https://github.com/webpack-contrib/uglifyjs-webpack-plugin config.plugins.push( new webpack.optimize.UglifyJsPlugin({ sourceMap: true, + extractComments: { + filename: 'LICENSES' + }, compress: { warnings: false } diff --git a/package.json b/package.json index a75fff150b..b7c4dcf58d 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "autoprefixer": "^7.1.2", "babel-core": "^6.26.0", "babel-loader": "^7.1.1", + "babel-minify-webpack-plugin": "^0.2.0", "babel-preset-es2015": "^6.24.1", "babel-preset-vue-app": "^1.2.1", "chalk": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index 775798d596..fb7693c33c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -464,7 +464,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-core@^6.17.0, babel-core@^6.26.0: +babel-core@^6.17.0, babel-core@^6.24.1, babel-core@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8" dependencies: @@ -544,6 +544,10 @@ babel-helper-define-map@^6.24.1: babel-types "^6.26.0" lodash "^4.17.4" +babel-helper-evaluate-path@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.2.0.tgz#0bb2eb01996c0cef53c5e8405e999fe4a0244c08" + babel-helper-explode-assignable-expression@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa" @@ -561,6 +565,10 @@ babel-helper-explode-class@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" +babel-helper-flip-expressions@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.2.0.tgz#160d2090a3d9f9c64a750905321a0bc218f884ec" + babel-helper-function-name@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" @@ -585,6 +593,18 @@ babel-helper-hoist-variables@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" +babel-helper-is-nodes-equiv@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz#34e9b300b1479ddd98ec77ea0bbe9342dfe39684" + +babel-helper-is-void-0@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-helper-is-void-0/-/babel-helper-is-void-0-0.2.0.tgz#6ed0ada8a9b1c5b6e88af6b47c1b3b5c080860eb" + +babel-helper-mark-eval-scopes@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.2.0.tgz#7648aaf2ec92aae9b09a20ad91e8df5e1fcc94b2" + babel-helper-optimise-call-expression@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257" @@ -610,6 +630,10 @@ babel-helper-remap-async-to-generator@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" +babel-helper-remove-or-void@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.2.0.tgz#8e46ad5b30560d57d7510b3fd93f332ee7c67386" + babel-helper-replace-supers@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a" @@ -621,6 +645,10 @@ babel-helper-replace-supers@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" +babel-helper-to-multiple-sequence-expressions@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.2.0.tgz#d1a419634c6cb301f27858c659167cfee0a9d318" + babel-helper-vue-jsx-merge-props@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.2.tgz#aceb1c373588279e2755ea1cfd35c22394fd33f8" @@ -646,6 +674,14 @@ babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" +babel-minify-webpack-plugin@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-minify-webpack-plugin/-/babel-minify-webpack-plugin-0.2.0.tgz#ef9694d11a1b8ab8f3204d89f5c9278dd28fc2a9" + dependencies: + babel-core "^6.24.1" + babel-preset-minify "^0.2.0" + webpack-sources "^1.0.1" + babel-plugin-array-includes@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/babel-plugin-array-includes/-/babel-plugin-array-includes-2.0.3.tgz#cf5452e81c7b803fb7959f1045ac88e2ec28ff76" @@ -682,6 +718,71 @@ babel-plugin-istanbul@^4.1.4: istanbul-lib-instrument "^1.7.2" test-exclude "^4.1.1" +babel-plugin-minify-builtins@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.2.0.tgz#317f824b0907210b6348671bb040ca072e2e0c82" + dependencies: + babel-helper-evaluate-path "^0.2.0" + +babel-plugin-minify-constant-folding@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.2.0.tgz#8c70b528b2eb7c13e94d95c8789077d4cdbc3970" + dependencies: + babel-helper-evaluate-path "^0.2.0" + +babel-plugin-minify-dead-code-elimination@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.2.0.tgz#e8025ee10a1e5e4f202633a6928ce892c33747e3" + dependencies: + babel-helper-evaluate-path "^0.2.0" + babel-helper-mark-eval-scopes "^0.2.0" + babel-helper-remove-or-void "^0.2.0" + lodash.some "^4.6.0" + +babel-plugin-minify-flip-comparisons@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.2.0.tgz#0c9c8e93155c8f09dedad8118b634c259f709ef5" + dependencies: + babel-helper-is-void-0 "^0.2.0" + +babel-plugin-minify-guarded-expressions@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.2.0.tgz#8a8c950040fce3e258a12e6eb21eab94ad7235ab" + dependencies: + babel-helper-flip-expressions "^0.2.0" + +babel-plugin-minify-infinity@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.2.0.tgz#30960c615ddbc657c045bb00a1d8eb4af257cf03" + +babel-plugin-minify-mangle-names@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.2.0.tgz#719892297ff0106a6ec1a4b0fc062f1f8b6a8529" + dependencies: + babel-helper-mark-eval-scopes "^0.2.0" + +babel-plugin-minify-numeric-literals@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.2.0.tgz#5746e851700167a380c05e93f289a7070459a0d1" + +babel-plugin-minify-replace@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.2.0.tgz#3c1f06bc4e6d3e301eacb763edc1be611efc39b0" + +babel-plugin-minify-simplify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.2.0.tgz#21ceec4857100c5476d7cef121f351156e5c9bc0" + dependencies: + babel-helper-flip-expressions "^0.2.0" + babel-helper-is-nodes-equiv "^0.0.1" + babel-helper-to-multiple-sequence-expressions "^0.2.0" + +babel-plugin-minify-type-constructors@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.2.0.tgz#7f3b6458be0863cfd59e9985bed6d134aa7a2e17" + dependencies: + babel-helper-is-void-0 "^0.2.0" + babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" @@ -929,6 +1030,22 @@ babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-e babel-plugin-syntax-exponentiation-operator "^6.8.0" babel-runtime "^6.22.0" +babel-plugin-transform-inline-consecutive-adds@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.2.0.tgz#15dae78921057f4004f8eafd79e15ddc5f12f426" + +babel-plugin-transform-member-expression-literals@^6.8.5: + version "6.8.5" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.8.5.tgz#e06ae305cf48d819822e93a70d79269f04d89eec" + +babel-plugin-transform-merge-sibling-variables@^6.8.6: + version "6.8.6" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.8.6.tgz#6d21efa5ee4981f71657fae716f9594bb2622aef" + +babel-plugin-transform-minify-booleans@^6.8.3: + version "6.8.3" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.8.3.tgz#5906ed776d3718250519abf1bace44b0b613ddf9" + babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06" @@ -936,18 +1053,46 @@ babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.26.0" +babel-plugin-transform-property-literals@^6.8.5: + version "6.8.5" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.8.5.tgz#67ed5930b34805443452c8b9690c7ebe1e206c40" + dependencies: + esutils "^2.0.2" + babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f" dependencies: regenerator-transform "^0.10.0" +babel-plugin-transform-regexp-constructors@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.2.0.tgz#6aa5dd0acc515db4be929bbcec4ed4c946c534a3" + +babel-plugin-transform-remove-console@^6.8.5: + version "6.8.5" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.8.5.tgz#fde9d2d3d725530b0fadd8d31078402410386810" + +babel-plugin-transform-remove-debugger@^6.8.5: + version "6.8.5" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.8.5.tgz#809584d412bf918f071fdf41e1fdb15ea89cdcd5" + +babel-plugin-transform-remove-undefined@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.2.0.tgz#94f052062054c707e8d094acefe79416b63452b1" + dependencies: + babel-helper-evaluate-path "^0.2.0" + babel-plugin-transform-runtime@^6.15.0, babel-plugin-transform-runtime@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee" dependencies: babel-runtime "^6.22.0" +babel-plugin-transform-simplify-comparison-operators@^6.8.5: + version "6.8.5" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.8.5.tgz#a838786baf40cc33a93b95ae09e05591227e43bf" + babel-plugin-transform-strict-mode@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" @@ -955,6 +1100,10 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" +babel-plugin-transform-undefined-to-void@^6.8.3: + version "6.8.3" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.8.3.tgz#fc52707f6ee1ddc71bb91b0d314fbefdeef9beb4" + babel-plugin-transform-vue-jsx@^3.1.2: version "3.5.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-3.5.0.tgz#6b1ad29351ad753919403675f0bf8b2a43e17671" @@ -1041,6 +1190,34 @@ babel-preset-es2015@^6.24.1, babel-preset-es2015@^6.3.13: babel-plugin-transform-es2015-unicode-regex "^6.24.1" babel-plugin-transform-regenerator "^6.24.1" +babel-preset-minify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-minify/-/babel-preset-minify-0.2.0.tgz#006566552d9b83834472273f306c0131062a0acc" + dependencies: + babel-plugin-minify-builtins "^0.2.0" + babel-plugin-minify-constant-folding "^0.2.0" + babel-plugin-minify-dead-code-elimination "^0.2.0" + babel-plugin-minify-flip-comparisons "^0.2.0" + babel-plugin-minify-guarded-expressions "^0.2.0" + babel-plugin-minify-infinity "^0.2.0" + babel-plugin-minify-mangle-names "^0.2.0" + babel-plugin-minify-numeric-literals "^0.2.0" + babel-plugin-minify-replace "^0.2.0" + babel-plugin-minify-simplify "^0.2.0" + babel-plugin-minify-type-constructors "^0.2.0" + babel-plugin-transform-inline-consecutive-adds "^0.2.0" + babel-plugin-transform-member-expression-literals "^6.8.5" + babel-plugin-transform-merge-sibling-variables "^6.8.6" + babel-plugin-transform-minify-booleans "^6.8.3" + babel-plugin-transform-property-literals "^6.8.5" + babel-plugin-transform-regexp-constructors "^0.2.0" + babel-plugin-transform-remove-console "^6.8.5" + babel-plugin-transform-remove-debugger "^6.8.5" + babel-plugin-transform-remove-undefined "^0.2.0" + babel-plugin-transform-simplify-comparison-operators "^6.8.5" + babel-plugin-transform-undefined-to-void "^6.8.3" + lodash.isplainobject "^4.0.6" + babel-preset-stage-2@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz#d9e2960fb3d71187f0e64eec62bc07767219bdc1" @@ -4003,6 +4180,10 @@ lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" +lodash.some@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.some/-/lodash.some-4.6.0.tgz#1bb9f314ef6b8baded13b549169b2a945eb68e4d" + lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -5938,12 +6119,6 @@ schema-utils@^0.3.0: dependencies: ajv "^5.0.0" -script-ext-html-webpack-plugin@^1.8.5: - version "1.8.5" - resolved "https://registry.yarnpkg.com/script-ext-html-webpack-plugin/-/script-ext-html-webpack-plugin-1.8.5.tgz#7a408383d7f3329da8f59d503be25cc39a53f3f3" - dependencies: - debug "^2.6.8" - semver-diff@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36"