PMSI-AlignAlytics / dimple

An object-oriented API for business analytics
Other
2.73k stars 556 forks source link

Use with ES6 imports or CommonJS requires #222

Open donpinkus opened 8 years ago

donpinkus commented 8 years ago

I want to use Dimple in my react app, which is using ES6 imports:

First, I did npm install --save dimple-js. This adds the dimple-js folder to my project's /node_modules/.

Second, I try to import it from my component:

import * from 'dimple-js';

...

However, trying to import anything from 'dimple-js' throws a syntax error.

How should DimpleJS be imported?

phucanhapril commented 7 years ago

hi! i can't remember where i found this but you actually have to use npm install -S git+https://github.com/PMSI-AlignAlytics/dimple.git in order to import (then you should import from dimple rather than dimple-js)

good luck! if you get dimple working in react, i would loooove to see how you did it

hangzho commented 6 years ago

Dimple denpends on the D3. So we need install D3 too. Following is the way I make the ES6 import work:

// install the libraries first
npm i d3@4.3.0
npm install -S git+https://github.com/PMSI-AlignAlytics/dimple.git
// import the libraries
import 'd3';
import dimple from 'dimple';