Skip to content

Commit

Permalink
fix: don't let uglify-es inline functions with arguments
Browse files Browse the repository at this point in the history
Fixes #346.

This is a workaround for a bug in uglifyjs2
(mishoo/UglifyJS#2842), which can cause name
collisions when a function with arguments is inlined. This can cause an
unintended shadowing of a `var` or `let`, or a `TypeError: Assignment to
constant variable` in case of a `const`.
  • Loading branch information
sven3270350 committed Aug 6, 2018
1 parent 2d8953d commit bec3fdf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.prod.js
Expand Up @@ -315,6 +315,9 @@ module.exports = {
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false,
// Don't inline functions with arguments, to avoid name collisions:
// https://github.com/mishoo/UglifyJS2/issues/2842
inline: 1,
},
mangle: {
safari10: true,
Expand Down

0 comments on commit bec3fdf

Please sign in to comment.