Trouble requiring mapd-connector's browser-connector


I’ve followed your How To: Require Stubborn Modules guide, but am still having trouble trying to require mapd-connector’s browser connector module.

Unfortunately the mapd-connector library is not (yet) on NPM, so I’ve copied and pasted its browser-connector.js file to a Github Gist:

and am trying to require it as follows:

MapdCon = require("").catch(() => window.MapdCon)

The browser-connector should expose a global object called MapdCon, which is what I’ve tried to do above, but unfortunately Observable reports MapdCon as undefined.

Here is an example Block where I can successfully load data using mapd-connector's browser-connector module:

Any advice would be appreciated, thanks in advance!

The MapD Connector is especially tricky because it’s not just an IIFE, it also has a bunch of dependencies that are not declared in the browser-connector.js. I was able to follow their basic example on GitHub and it appears to work after you jump through a few hoops:

1 Like

Terrific, thanks very much Mike for the help!

I’m fairly certain that the browser-connector bundle includes the necessary deps, (I’ll double check with my team) but it seems that part of the reason it won’t work in Observable has to do with those deps not having a Promise based API.

Anyhow, I’m excited to use MapD connector in Observable and am sure others will be as well!