Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cederom opened this issue Aug 22, 2021 · 4 comments
Closed

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

cederom opened this issue Aug 22, 2021 · 4 comments

Comments

@cederom
Copy link

cederom commented Aug 22, 2021

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:

@cederom
Copy link
Author

cederom commented Aug 22, 2021

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) {

@cederom
Copy link
Author

cederom commented Aug 23, 2021

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!

@cederom cederom changed the title d3-array/dist/d3-array.js: Unexpected token (139:15) BUG: d3-array/dist/d3-array.js: Unexpected token (139:15) Aug 23, 2021
@mbostock
Copy link
Member

Duplicate of #147.

@cederom
Copy link
Author

cederom commented Aug 23, 2021

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 :-) :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants