Terser: Regression: Superfluous parentheses around anonymous function passed as parameter

Created on 19 Oct 2019  路  3Comments  路  Source: terser/terser

Bug report or Feature request?

Bug (regression causing obviously suboptimal code)

Version (complete output of terser -V or specific git commit)

4.3.9

Complete CLI command or minify() options used

terser

terser input

foo(function(){});

terser output or error

foo((function(){}));

Expected result

foo(function(){});

git bisect says that the bug/suboptimal output got introduced in https://github.com/terser/terser/pull/433

Most helpful comment

Repeating the above link (currently hidden behind a t.co redirect): https://v8.dev/blog/preparser#pife

All 3 comments

This is intended. It improves parsing speed on most browsers.

Use the output option wrap_func_args=false to disable this. It's enabled by default now.

@fabiosantoscode - should disable this option by default in light of this:

"The V8 team recommends against using optimize-js nowadays: https://t.co/vSjB1StJtp"
https://twitter.com/mathias/status/1185086954855108608

/cc @mathiasbynens

Repeating the above link (currently hidden behind a t.co redirect): https://v8.dev/blog/preparser#pife

Was this page helpful?
0 / 5 - 0 ratings