vega / voyager

Visualization Tool for Data Exploration
http://vega.github.io/voyager
Other
1.44k stars 179 forks source link

embedded Voyager not working #812

Open declann opened 6 years ago

declann commented 6 years ago

Hi,

I've cloned the voyager github repo, run yarn, yarn test, yarn build and npm run build:lib various times to try to get a module I can embed.

Then when I run node and require('.') I get an error:

Cannot find module 'style-loader!css-loader!sass-loader!./font-awesome-sass-styles.loader!./font-awesome-sass.config.js'

src/lib-voyager.tsx has an import for font-awesome-sass-loader which I removed to get past this error. (this actually has a comment "TODO should this move to App?")

However, this leads to a Reference Error "self is not defined", which (whenever I disable Uglify) I can trace to the browserify file within isomorphic-fetch module which is being bundled.

https://github.com/matthew-andrews/isomorphic-fetch/blob/master/fetch-npm-browserify.js

Can anyone identify whats gone wrong here?

Am I doing something silly by trying to require in node? Is embedded Voyager working for others or is it generally broken? Is there something obvious to check in my environment?

Many thanks, Declan

declann commented 6 years ago

I have this working (or at least made a good bit of progress) by using webpack on a file which requires libvoyager. This generates a bundle that I can load in a webpage and the embedding works. We can probably improve the README on embedding Voyager (I might do this when I've used and understand embedded Voyager more)

The only coding change I needed is related to the following line, which I removed: https://github.com/vega/voyager/blob/3521d7811b17277a25f5a98bfa2d7e2577f37a39/src/lib-voyager.tsx#L10

Does it make sense to remove this on master?

davidanthoff commented 6 years ago

I also had difficulty with font-awesome. I am hosting voyager in an electron window. I ended up bundling everything with browserify, and then having a folder in the root for font-aweseome, that does seem to work. Here is the code.

It does feel a bit like a hack, so I would also welcome something more official.