From c94d03a5fc0a1f9a6d1b7a57fabb1dbc01f8430e Mon Sep 17 00:00:00 2001 From: Aleksey Smolenchuk Date: Sun, 22 Jul 2018 15:56:23 -0700 Subject: [PATCH] set typeofs: false to prevent mangling typeofs by uglify --- build/compiler.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/compiler.js b/build/compiler.js index 85e468fb..3464ddf2 100644 --- a/build/compiler.js +++ b/build/compiler.js @@ -505,6 +505,13 @@ function getConfig({target, env, dir, watch, cover}) { parallel: true, // default from webpack uglifyOptions: { compress: { + // typeofs: true (default) transforms typeof foo == "undefined" into foo === void 0. + + // This mangles mapbox-gl creating an error when used alongside with window global mangling: + // https://jeng.uberinternal.com/browse/WPT-1185 + // https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/189 + typeofs: false, + inline: 1, // inline=2 can cause const reassignment (https://github.com/mishoo/UglifyJS2/issues/2842) }, },