How to use D3 in Node.js properly?

前端 未结 3 1111
别跟我提以往
别跟我提以往 2020-12-02 10:06

I\'ve been trying to invoke D3 within Node.js. I tried firstly to import d3.v2.js from D3\'s website with the script tag, but then read this thread:

I want to run d3

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 10:44

    To use with ES6's import instead of require:

    import * as d3 from 'd3';
    

    This is perhaps obvious to any experienced babel/ES6-user, and I know this is an old question, but I came here in an attempt to figure this out. Hope this is helpful for someone.

    More on import vs. require is found here.

提交回复
热议问题