Reputation: 100386
I have been wondering this for a long time, using RequireJS, is there actually a difference between the global require function and the require function that is passed to a module like so:
define(function (require) {
// require === window.require ?
return {};
});
Upvotes: 1
Views: 391
Reputation: 100386
I asked the question of James Burke himself, author of RequireJS
They are different, the main thing is that the local require knows how to resolve './relative' dependency IDs relative to the module ID asking for the dependency..
The global one cannot do that. The global one has .config() on it, can be used to configure the loader. Those are the main differences.
see: https://github.com/requirejs/requirejs/issues/1505
Upvotes: 2