ErikGartner/dTree

How do I use dTree with npm?

migmacdev opened this issue · 2 comments

I'm getting the error "ReferenceError: d3 is not defined", the npm D3 module is installed, any help to fix this issue?

How are you using dTree?

I'm not too familiar with webpack etc. If you just load the dTree.js in a <script> tag make sure you load d3 before.

The way I solved this was to,

import * as d3 from d3;
import _ from 'lodash';
import dTree from 'd3-dtree'; 

// later in your constructor
window.d3 = d3;
window._ = _;