blackhole.js
blackhole.js copied to clipboard
add supporting nodejs
Do you mean to add the library to NPM? I can install it referring directly to the Github repo:
npm install d3 --save
npm install https://github.com/artzub/blackhole.js.git --save
This is how I load them in my React.js component:
import d3 from 'd3';
import blackhole from 'blackhole.js/blackhole.js';
But I get an issue with the D3 dependency:
Uncaught ReferenceError: d3 is not defined
here:
blackhole.utils = {
isFun: isFun,
func: func,
getFun: getFun,
emptyFun: emptyFun
};
d3.blackHole = blackhole;
I think it happends because
import d3 from 'd3'
in local scope.
If you use webpack for building then you can add vendors.js and part of webpack.config.js
const common = {
entry: {
app: ['./src/index.js'],
vendors: ['d3']
},
output: {
path: buildPath,
filename: 'app.js'
},
// ...
plugins: [
// ...
new webpack.ProvidePlugin({ d3: 'd3' }),
new webpack.optimize.CommonsChunkPlugin('vendors','vendors.js')
]
};
I think we have similar way in order to declare global dependencies
P.S. This task about adding method to collecte git information with using nodejs.
Thanks, that fixed it!