Skip to content

Commit

Permalink
Fix uglify options and add css asset optimisation (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravtiwari authored Jun 3, 2018
1 parent 4e56512 commit 26a55a9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"js-yaml": "^3.12.0",
"mini-css-extract-plugin": "^0.4.0",
"node-sass": "^4.9.0",
"optimize-css-assets-webpack-plugin": "^4.0.2",
"path-complete-extname": "^1.0.0",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.5",
Expand Down
11 changes: 10 additions & 1 deletion package/environments/production.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const Base = require('./base')

module.exports = class extends Base {
Expand All @@ -15,6 +16,8 @@ module.exports = class extends Base {
})
)

this.plugins.append('OptimizeCSSAssets', new OptimizeCSSAssetsPlugin())

this.config.merge({
devtool: 'nosources-source-map',
stats: 'normal',
Expand All @@ -26,15 +29,21 @@ module.exports = class extends Base {
cache: true,
sourceMap: true,
uglifyOptions: {
ecma: 5,
parse: {
// Let uglify-js parse ecma 8 code but always output
// ES5 compliant code for older browsers
ecma: 8
},
compress: {
ecma: 5,
warnings: false,
comparisons: false
},
mangle: {
safari10: true
},
output: {
ecma: 5,
comments: false,
ascii_only: true
}
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3918,6 +3918,13 @@ kind-of@^6.0.0, kind-of@^6.0.2:
version "6.0.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"

last-call-webpack-plugin@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz#9742df0e10e3cf46e5c0381c2de90d3a7a2d7555"
dependencies:
lodash "^4.17.5"
webpack-sources "^1.1.0"

lazy-cache@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
Expand Down Expand Up @@ -4604,6 +4611,13 @@ optimist@^0.6.1:
minimist "~0.0.1"
wordwrap "~0.0.2"

optimize-css-assets-webpack-plugin@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-4.0.2.tgz#813d511d20fe5d9a605458441ed97074d79c1122"
dependencies:
cssnano "^3.10.0"
last-call-webpack-plugin "^3.0.0"

optionator@^0.8.1, optionator@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
Expand Down

0 comments on commit 26a55a9

Please sign in to comment.