madskristensen / BundlerMinifier

Visual Studio extension
Other
616 stars 173 forks source link

Cannot Minify lamba with lots of valid bracket types #553

Open CreepyGnome opened 3 years ago

CreepyGnome commented 3 years ago

Installed product versions

Description

This line of code breaks the minifier:

result.data.reduce((a,x) => ({...a, [x.Id]: x}), {});

It doesn't like one or all of those various brackets to the right of the fat arrow.

Gives this output:

  Expected ')': ...
  Expected ')': ...
  Expected ';'
  Expected ';'
  Expected expression: :
  Expected ';'
  Expected expression: )
  Expected expression: ,
  Expected identifier: (
  Expected expression: )
  Expected ')': }

When not minified everything works, not sure why this isn't supported as it is valid JS.

Steps to recreate

  1. Minify this result.data.reduce((a,x) => ({...a, [x.Id]: x}), {});

Current behavior

Fails with the above errors

Expected behavior

Minify the valid line of JS.