I want to run d3 from a Cakefile

前端 未结 1 1757
慢半拍i
慢半拍i 2021-02-06 13:15

I\'d like to execute some d3 code from the command line. Initially I just tried something like:

task \'data\', \'Build some data with d3\', ->
      d3 = requ         


        
相关标签:
1条回答
  • 2021-02-06 14:00

    See D3's package.json. More specifically, the file you want to require when running inside Node or similar environments is index.js rather than d3.v2.js; this file contains some special patches that make D3 compatible with the require operator.

    To try it out for yourself, cd to the d3 repository, run node to create an interactive shell, and then say

    var d3 = require("./");
    

    Or, if you're in your own project folder, if you've installed D3 into node_modules/d3 via npm (npm install d3), you can say:

    var d3 = require("d3");
    
    0 讨论(0)
提交回复
热议问题