d3 / d3-delaunay

Compute the Voronoi diagram of a set of two-dimensional points.
https://d3js.org/d3-delaunay
ISC License
611 stars 57 forks source link

d3-delaunay@5.1.6 sideEffects breaks Delaunay class #99

Closed jloveless63 closed 4 years ago

jloveless63 commented 4 years ago

I performed an investigation on our code base where I replaced our usage of d3-voronoi with the usage of d3-delaunay. When doing so, with versions 5.1.6 and 5.2.0, I found an issue when running End-to-End tests against our code:

ERROR in ./node_modules/d3-delaunay/src/delaunay.js 26:15
Module parse failed: Unexpected token (26:15)
You may need an appropriate loader to handle this file type.
| return [x + Math.sin(x + y) * r, y + Math.cos(x - y) * r];
| }
> export default const Delaunay = /*@__PURE__*/ function () {
| class Delaunay {
| constructor(points) {

I found that back-stepping to version 5.1.5 alleviates the error, which is before d3-delaunay was marked as having no side effects. I have also found that, in version 5.2.0, changing the setting of sideEffects to:

 "sideEffects": [
   "./src/delaunay.js"
 ],

also alleviates the error.

mbostock commented 4 years ago

Does #100 fix this?

jloveless63 commented 4 years ago

100 does fix it. Well done!