List of available libraries?

Is there a list of available libraries? I was pleased to see require('@turf/turf') available (first, non-D3 lib I checked). I am assuming their might be available modules and any not available would be downloaded from NPM? Just curious if that’s the case or the library selection is limited in any way.

Hey Kuan! Welcome to Observable.

How modules work is that they load from unpkg.com - so any module that has an unpkg field or an AMD or UMD module entry point should work off the bat. unpkg pulls dynamically from npm, and supports all the npm niceties like semver. We also support dynamic import for ES6 modules if you specify the full path and use the ?module query string parameter for the module’s URL.

If there’s any specific module that’s giving you trouble, I’ll be happy to take a look and see if there’s a way to get it up and working.

1 Like

Question along the same lines — unpkg allows me to grab specific files from a package, like https://unpkg.com/three@0.89.0/examples/js/loaders/GLTFLoader.js. But this code, which works in Browserify:

GLTFLoader = require('three/examples/js/loaders/GLTFLoader.js')

…in Observable gives the result Error: invalid module. A lot of useful three.js code is in that examples/js folder, and unfortunately the files are not using CommonJS or ES6 modules, just global exports. Is it possible to support those imports in Observable? Would it help anything if we moved everything to modules on the three.js side? Thanks :slight_smile:

EDIT: Oops, just found your article here, which seems to address my question. Sorry about the stubborn modules! :sweat_smile:

Thanks, also just saw the documentation @donmccurdy linked to. Very helpful!