How to load experimental versions of libraries?

Spawned from "global is undefined" when using viz.js through d3-graphviz

https://github.com/observablehq/notebook-stdlib#require says “loaded from unpkg”. Is this the only way?

It would be useful to be able to load libraries from anywhere, e.g. a local web server.

this works for me in Chrome:

require("http://localhost/d3/d3-geo-projection/build/d3-geo-projection.js")

1 Like

I didn’t (/don’t) really understand how require works either. Check out my notes on requiring a random js file from the web: https://beta.observablehq.com/@sorig/how-to-require-stubborn-modules-a-case-study

2 Likes

@Fil: This gives me Error: unable to load module:

d3_graphviz = require(“http://localhost:8080/build/d3-graphviz.js”)

@sorig: Thanks. I will dig into your notes.

Replacing localhost with 127.0.0.1 made it work:
d3_graphviz = require(“http://127.0.0.1:8080/build/d3-graphviz.js”)

See the note at the bottom of https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content

1 Like