[Answer]-RequireJS call to "module"

1👍

RequireJS defines a couple special modules. One of them is named module. It gives access to the current module as an object. For instance, you can export something by setting module.exports to a value. This is just one way to export things from a module. It is possible to get the module name through module.id and its URL through module.uri (yes, that’s uri).

There is also a function module.config() that you can use to access the value of the field of the config setting in the object you pass to require.config(). The code currently in the question appears incorrect, it should be:

var pr = module.config().prefix;

The other special module is require, which just gives a reference to the function you can use to load modules.

All of this is stock RequireJS functionality documented in the API.

👤Louis

Leave a comment