-
Notifications
You must be signed in to change notification settings - Fork 36
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
Problems with "module" special dependency #104
Comments
Ok, I just made a pull request solving problem 1. Note that I chose the "modules" variable name instead of "moduleConfigs", because I think we can solve #92 by putting all the modules exports in this object instead of declaring one (global) variable per AMD module. |
I think the problem is due to the blacklisting of 'module' dependency', so I propose to generate CJS modules like this: var amd_modules={
'my_module': {
exports: {}
config: function() {
return { /*...*/ };
}
}
};
amd_modules['my_module'] = function (require, exports, module) {
/* ... no transforms of module/exports here */
return exports;
}({},amd_modules['my_module'].exports, amd_modules['my_module']); If we agree on the output format, I can give it a try. |
You can use the |
I've found some problems when trying to the
module
special dependency in order to access themodule.config()
.Here is an example:
This code is converted to:
The module configs are stored in a
module
variable. It's a pretty bad variable name, as it can break shimmed modules included in the same file. In fact, many libraries have a universal module definition in top of them so that the same code can work in node (CJS) and in the browser (AMD), and they often test the availability of amodule
variable to detect the module format.I would suggest renaming this variable to something else... maybe
moduleConfigs
. Another idea would be to store the configs of each module in the module's variable itself, as in this example:As an example:
The code above is converted to:
This is obviously wrong.
I can probably submit a pull request solving the first point. The second one is more tricky, I'm not sure I can solve the problem by myself.
The text was updated successfully, but these errors were encountered: