Skip to content

Commit aadae6a

Browse files
committed
fix: don't let uglify-es inline functions with arguments
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`.
1 parent 2ffd32b commit aadae6a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/react-scripts/config/webpack.config.prod.js

+3
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ module.exports = {
315315
// Pending further investigation:
316316
// https://github.com/mishoo/UglifyJS2/issues/2011
317317
comparisons: false,
318+
// Don't inline functions with arguments, to avoid name collisions:
319+
// https://github.com/mishoo/UglifyJS2/issues/2842
320+
inline: 1,
318321
},
319322
mangle: {
320323
safari10: true,

0 commit comments

Comments
 (0)