Reputation: 13
I need to convert normal JSON to JSON Graph. I tried json-graphify but the "import" statement in it throws an error saying it is not supported now.
Upvotes: 0
Views: 288
Reputation: 3663
The code contained in json-graphify's src/
directory is the prebuilt/precompiled code, which uses syntax not yet available to node or browsers. The module's author didn't check in the compiled code to github, though it is available on npm (notice the project's main entry file points to lib/index.js
, not src/index.js
).
You either need to: compile it yourself via babel src --out-dir lib --optional runtime
(see the project's compile script), or install the module via npm. The former approach will build the compiled code into the lib/
directory. The latter (probably the recommended approach) will download a precompiled version that can be used via const graphify = require('json-graphify')
.
Upvotes: 1