-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specifying configuration options #20
Comments
We talked a bit in IRC about this, IIRC, and I am open to specifying some specifics about this, but I do believe this is a loader API responsibility, and not something that should be on define(), as define() is for module definitions that should be valid outside any config values. This will be true in ES6 too, where the config options will be on ModuleLoader, and not in any module definition syntax or API. Although I would prefer to see a ModuleLoader.prototype.config() to accept the API, and have given feedback to that effect to the ES folks. For AMD though, I would be open to specifying that it should be Would like to hear from some other AMD folks on that though before writing in the API doc. But I definitely think it should not be on define(). |
The part of our previous conversation that I didn't follow was the distinction between the module loading and module definition API. It's true that the This may just be that I am not familiar enough with ES6 module loaders. As I understand them, their responsibility is much more directed than AMD's |
Perhaps this will help:
So to get module loading to occur, the loader API, via In requirejs, In ES, the configuration of how loading is done is done on a ModuleLoader instance (or System, if configuring the default loader). Similarly, I view config working in AMD module loaders, off the module loader API. For loaders like requirejs that allow using |
The "commonConfig" document defines a set of configuration options that AMD script loaders should support. It does not specify how these options can actually be specified.
The AMD specification is incomplete without this detail. Consumers are forced to find and use a custom, non-standard API in order to specify standardized information. This makes application code less portable generally.
As a strawman proposal, consider a new
config
method defined on the globaldefine
function. Example usage:The text was updated successfully, but these errors were encountered: