jasondavies / d3-cloud

Create word clouds in JavaScript.
https://www.jasondavies.com/wordcloud/
Other
3.84k stars 1.07k forks source link

only require canvas when not in the browser #76

Closed mathisonian closed 9 years ago

mathisonian commented 9 years ago

Hey @jasondavies, thanks for the cool lib!

This PR ensures that the require('canvas') statement is only fired when the library is being used in node (not in the browser). This will play nicely with #72, and if these both get merged the library should work seamlessly in client-side environments.

This fixes errors that I've been seeing while integrating the library into lightning-viz/lighting

mathisonian commented 9 years ago

@cesine Ah okay, I didn't realize PRs weren't being actively merged. let's give @jasondavies some time to respond otherwise I'll send him an email asking about plans for the project if we don't hear anything in a couple of days

mathisonian commented 9 years ago

i wanted to note that in particular I'm working on getting vega to work well with browserify and webpack, (and because vega depends on d3-cloud) that depends on making sure this library plays nicely as well