Closed christianvari closed 4 years ago
@christianvari thanks for reaching out.
As you can see here, accessor-fn
is a dependency of this package:
https://github.com/vasturiano/aframe-forcegraph-component/blob/master/package.json#L52
Have you npm installed this package fully?
@vasturiano Thanks for the reply.
I am using it with react. I fixed the issue changing the line 7 of /aframe-forcegraph-component/index.js from "var accessorFn = require('accessor-fn');" to "import accessorFn from 'accessor-fn';"
Is there a better solution?
@christianvari you should ensure that your application build can read from commonJs modules, using require
statements.
ok, thank you for your time.
Hello and thank you for sharing this project.
Describe the bug Using the cdn is all fine but if I use the npm module and then I use import, i got this error. I tried to add accessor-fn to my dependencies but it didn't work.
This is the stacktrace
TypeError: accessorFn is not a function using the npm module i.tick C:/Users/christian.vari/Desktop/vr_scr/node_modules/aframe-forcegraph-component/index.js:300 297 | } 298 | 299 | this.state.hoverObj = topObject; 300 | this.state.tooltipEl.setAttribute('value', topObject ? accessorFn(this.data[topObject.graphObjType + 'Label'])(topObject.data) || '' : ''); | ^ 301 | this.state.subTooltipEl.setAttribute('value', topObject ? accessorFn(this.data[topObject.graphObjType + 'Desc'])(topObject.data) || '' : ''); 302 | } 303 |