Skip to content

Commit

Permalink
Build: Add work-around for safari 10 let bug (#26068)
Browse files Browse the repository at this point in the history
* Build: Add work-around for safari 10 let bug

See mishoo/UglifyJS#1851

* Add the mangle option to the right minifier. Remove the redundant one.

* change the opt extension to min to cache break the uglify change
  • Loading branch information
blowery authored Jul 15, 2018
1 parent ecc06f6 commit a04e527
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ const webpackConfig = {
output: {
path: path.join( __dirname, 'public' ),
publicPath: '/calypso/',
filename: '[name].[chunkhash].opt.js', // prefer the chunkhash, which depends on the chunk, not the entire build
chunkFilename: '[name].[chunkhash].opt.js', // ditto
filename: '[name].[chunkhash].min.js', // prefer the chunkhash, which depends on the chunk, not the entire build
chunkFilename: '[name].[chunkhash].min.js', // ditto
devtoolModuleFilenameTemplate: 'app:///[resource-path]',
},
optimization: {
Expand Down Expand Up @@ -112,6 +112,9 @@ const webpackConfig = {
*/
collapse_vars: false,
},
mangle: {
safari10: true,
},
ecma: 5,
},
} ),
Expand Down Expand Up @@ -254,25 +257,4 @@ if ( ! config.isEnabled( 'desktop' ) ) {
);
}

if ( shouldMinify ) {
webpackConfig.plugins.push(
new UglifyJsPlugin( {
cache: 'docker' !== process.env.CONTAINER,
parallel: true,
sourceMap: Boolean( process.env.SOURCEMAP ),
uglifyOptions: {
compress: {
/**
* Produces inconsistent results
* Enable when the following is resolved:
* https://github.com/mishoo/UglifyJS2/issues/3010
*/
collapse_vars: false,
},
ecma: 5,
},
} )
);
}

module.exports = webpackConfig;

0 comments on commit a04e527

Please sign in to comment.