Martin36 / react-gauge-chart

React component for displaying a gauge chart
https://martin36.github.io/react-gauge-chart/
MIT License
220 stars 83 forks source link

TypeError: (0 , _d.arc) is not a function #77

Open resparis opened 3 years ago

resparis commented 3 years ago

Hi, I download the package and install from a local directory using npm install PATH. The import worked but when I tried to use it I got the following error:

TypeError: (0 , _d.arc) is not a function GaugeChart I:/gauge_module/react-gauge-chart/dist/GaugeChart/index.js:54 51 | var container = (0, _react.useRef)({}); 52 | var nbArcsToDisplay = (0, _react.useRef)(0); 53 | var colorArray = (0, _react.useRef)([]);

54 | var arcChart = (0, _react.useRef)((0, _d.arc)()); | ^ 55 | var arcData = (0, _react.useRef)([]); 56 | var pieChart = (0, _react.useRef)((0, _d.pie)()); 57 | var prevProps = (0, _react.useRef)(props); View compiled

eivindnorling commented 1 year ago

I also have this exact error after building my app for production. I am using the latest version v0.4.1 and I am using parcel 2 as a bundler.

TypeError: (0 , r.arc) is not a function
    at d (index.js:54:41)
    at aD (react-dom.production.min.js:167:137)
    at s (react-dom.production.min.js:290:337)
    at lQ (react-dom.production.min.js:280:389)
    at react-dom.production.min.js:280:320
    at lG (react-dom.production.min.js:280:325)
    at lj (react-dom.production.min.js:271:88)
    at lF (react-dom.production.min.js:268:429)
    at V (scheduler.production.min.js:13:203)
    at MessagePort.G (scheduler.production.min.js:14:128)

Error points to the _d on line 54: var arcChart = (0, _react.useRef)((0, _d.arc)()); of the index.js file 📃

and its the var _d = require("d3"); that actually fails in some way.

I think it all boils down to: https://github.com/Martin36/react-gauge-chart/issues/133

eivindnorling commented 1 year ago

https://github.com/d3/d3-selection-multi/issues/11