我正在创建一个个人网站/组合,我偶然发现了强大的gatsby.js软件包.
我还需要将一个复杂的数据集可视化用于研究目的,我想使用d3.js,并包括我在Gatsby供电网站中创建的仪表板.
可以在反应组件中使用d3 - > https://medium.com/@Elijah_Meeks/interactive-applications-with-react-d3-f76f7b3ebc71
从理论上讲,Gatsby应该能够支持d3集成,但到目前为止我的尝试都失败了.
这是我尝试过的:
完成Gatsby教程https://www.gatsbyjs.org/tutorial/
我正在使用gatsbyjs文档中已完成的第4个教程网站,并添加了以下内容
npm install --save d3
Run Code Online (Sandbox Code Playgroud)
添加了utils/d3.js
文件内容
import d3 from "d3"
module.exports = d3
Run Code Online (Sandbox Code Playgroud)
我还在gatsby-config.js插件中添加了d3.
我运行gatsby develop,并收到以下错误,挂起.
success delete html files from previous builds — 0.005 s
success open and validate gatsby-config.js — 0.003 s
(node:8725) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 2): Error: Unable to find plugin "d3"
(node:8725) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.
In the future, promise rejections that are not handled will terminate …Run Code Online (Sandbox Code Playgroud)