Q:

Can I get the URL a RequireJS dependecy maps to?

Can I get the URL a RequireJS dependecy maps to?
var foo = require('my-dependency');

I know my-dependency is being pulled from http://localhost/version/my-dependency.js. Does RequireJS expose an API to get this value?

A:

You can use require.toUrl("my-dependency") to get a URL that is relative to your current module. For instance, this should output a relative URL:
define(function (require) {
  console.log(require.toUrl("my-dependency"));
});

You need to use the local require for this so that RequireJS knows what module it is being called from. (There's no need for a dependency list above. If you do not pass a list, RequireJS uses a dependency list of ["require", "module", "exports"].)
I don't know of a single-step way to get an absolute URL but if you need an absolute URL you could combine the URL provided by module.uri with the return value of require.toUrl:
define(function (require, module) {
  console.log(join(module.uri, require.toUrl("my-dependency")));
});

(join is a function that is capable of joining URLs. You can use URI.js, some other library, or write your own.)

