Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Set "typeofs: false" to prevent mangling typeofs by uglify #439

Merged
merged 2 commits into from
Aug 1, 2018
Merged
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
9 changes: 8 additions & 1 deletion build/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,14 @@ function getConfig({target, env, dir, watch, cover}) {
parallel: true, // default from webpack
uglifyOptions: {
compress: {
inline: 1, // inline=2 can cause const reassignment (https://github.com/mishoo/UglifyJS2/issues/2842)
// 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://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/189
typeofs: false,

// inline=2 can cause const reassignment
// https://github.com/mishoo/UglifyJS2/issues/2842
inline: 1,
},
},
}),
Expand Down