d3/d3-array

BUG: d3-array/dist/d3-array.js: Unexpected token (139:15)

cederom opened this issue · 4 comments

Android Bundling failed 4845ms
SyntaxError: (..)my_project/node_modules/d3-array/dist/d3-array.js: Unexpected token (139:15)

  137 |   var sum = 0, index = 0;
  138 |   return Float64Array.from(values, valueof === undefined
> 139 |     ? v => (sum += +v || 0)
      |                ^
  140 |     : v => (sum += +valueof(v, index++, values) || 0));
  141 | }
  142 |

I am working on mobile application with macOS 11.5.2, Node 16.6.1, React 16.13.1, React Native 0.63.4, npm 7.20.5, D3 version is 7.0.1, D3-ARRAY 3.0.2.

This is a blocker for D3 as D3-ARRAY is pulled as dependency, the problem occurs on import, so whole D3 needs to be removed from the project.

Please advise :-)

Some more reports:

Looks like this code got unreadable even for the compiler ;-) Please help @Fil @mbostock :-)

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));
}

export default function cumsum(values, valueof) {

Hey @mbostock why did you close with no comment?! Syntax looks invalid! When I replace that code with return 0 everything works fine. Are you sure this syntax is okay??? Looks like a BUG!

Duplicate of #147.

This is a Babel compiler bug then, should be solved with babel/babel#13581. Thanks for the hint. I am embedded developer working mostly with C.. man this JavaScript stuff is a wild thing :-) :-)