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 facebook#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
ppvg committed Aug 6, 2018
1 parent 2ffd32b commit aadae6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
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 aadae6a

Please sign in to comment.