[Resolved] Upgrading to 2.2.1 breaks module compilation

I just upgraded my Meteor app from 1.10.2 and noticed that it broke compilation of a file under node_modules. It appears in the file cumsum.js of d3-array. This package is used by three.js.

The error reported is:

=> Errors prevented startup:                  
   
   While building for web.browser:
   node_modules/d3-array/src/cumsum.js:4:15: Unexpected token (4:15)
   
=> Your application has errors. Waiting for file change.

The file is actually pretty short:

export default function cumsum(values, valueof) {
  var sum = 0, index = 0;
  return Float64Array.from(values, valueof === undefined
    ? v => (sum += +v || 0)
    : v => (sum += +valueof(v, index++, values) || 0));
}

Line 4:15 refers to the “m” of the token sum in the first line. How can this cause an error?!

I saw a couple of babel updates between 1.10.1 and 2.2.1, might this be related here?

1 Like

Okay, that’s actually a bug in the Babel compiler that also affects TypeScript projects:

1 Like

The best workaround I could find for the time being is to copy d3-array to a local folder, patch it and reference it from package.json as described here:

It’s weird, but it works. I hope the Babel project will release a fix soon.

1 Like

Allegedly fixed in

The question is: Does this also apply to ES6 projects? It’s referring to TypeScript.