d3/d3-array

Failed to minify code from this file ./node_modules/d3-array/src/rollup.js:3

agupta93 opened this issue · 10 comments

While building with create-react-app getting the above error after the latest release

Can someone please check it is getting a blocker for our release

Looks like this commit caused the problem.
729367e#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R24

Webpack is trying to include rollup.js which contains ES6 expression and cannot be uglified.
Below is my error log

static/js/main.e63b9209.js from UglifyJs
Unexpected token: name (index) [./~/d3-array/src/rollup.js:3,0][static/js/main.e63b9209.js:47905,6]

Can one of you provide a way to replicate the behavior? Ideally a complete repo where someone could clone it and run npm start or something in order to see the error. Thanks!

Also, what is the expected behavior? Uglify does not support ES6, which is not a problem with D3.

I found the error only occurs with react-scripts v1.x and the error disappeared after upgrading to v2.

@curran The expected behavior is successful build with creat-react-app project. However as it is already resolved in the latest react-scripts v2, I think this issue can be closed.

The issue mentioned here is in the rollup file. It is written in ES6 so when create react app tries to minify the same it starts breaking. The issue might not be present in react-scripts v2 but forcing people to upgrade to that makes it a breaking change which should be a major version update and not a minor version update

Yes, I’m starting to adopt more recent ES features in D3 modules. I’m going to do a major version bump when I rewrite the array methods to allow iterables rather than just arrays, but the addition of d3.group and d3.rollup was backwards-compatible and thus only saw a minor version bump.

@mbostock It is not currently backward compatible as we get this error while trying to build via react-scripts 1.x.x. Forcing an upgrade would not be a good solution

The definition of backwards-compatible is subjective; see Why Semantic Versioning Isn’t for context. At any rate, since I’m planning on following this up with a major version bump to switch to iterables, I’m happy to defer the addition of group and rollup to d3-array@2 (d3@6) and consequently have unpublished 1.3.0.

@mbostock If that could happen it would be really very helpful. Would save us a lot of trouble in our application :) Thanks a lot