jspm / registry

The jspm registry and package.json override service
https://jspm.io
229 stars 255 forks source link

Using ES6 and github AMD modules (e.g., github:mbostock/topojson) #577

Open richburdon opened 9 years ago

richburdon commented 9 years ago

I'm using ES6 and a dozen or so modules, which are all working fine, but on adding a new github module (github:mbostock/topojson) which requires the amd loader I am running into problems:

For example, "d3" creates the following loader: module.exports = require("github:mbostock/d3@3.5.6/d3");

which means I can do the following successfully: import "d3";

But "github:mbostock/topojson" creates: define(["github:mbostock/topojson@1.6.19/topojson"], function(main) { return main; });

So when I do the following, the package is loaded, but no globals are defined: import 'mbostock/topojson';

NOTE, the correct "globals' are present in main above, but I don't know how to import these.

Do I need to create a shim?

guybedford commented 9 years ago

Yes it sounds like you'd want to shim the package to make it export globals here.