You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that r.js will skip transforming define calls if it detects more than one,
this is presumably because it's assumed if there is more than one define then the file's already
been pre-processed and has named define calls. (Or not please correct me.)
The issue I'm having is with Velocity, which legitimately has two define calls for the same module here:
This is to test for a jQuery shim, and alternately require jQuery or not, depending on whether the shim exists.
The define calls were named due to r.js not transforming the calls with a name, the calls should be:
But r.js should ideally transform that into the first block, or whatever velocity happens to be named in the configuration.
Do you have any insight on this? Is it non-breaking for r.js to be changed to write multiple named define calls? Is it possible to detect if the define calls are in a condition like this?
Thanks!
The text was updated successfully, but these errors were encountered:
The expectation is that there is just one define() call in the file. This sort of dynamic alternate setup will not be possible in ES6 modules, so I suggest that the project just choose one definition and stick with that. I suggest choosing the one that does not require jQuery if it can operate without jQuery anyway.
Perhaps the library could move to a model where if some other code attaches velocity.$ to it, it would do extra jQuery things, but not have a hard dependency on it.
Closing as a discussion ticket. Feel free to continue discussion here.
Hi James,
I have noticed that r.js will skip transforming
define
calls if it detects more than one,this is presumably because it's assumed if there is more than one define then the file's already
been pre-processed and has named define calls. (Or not please correct me.)
The issue I'm having is with Velocity, which legitimately has two define calls for the same module here:
This is to test for a jQuery shim, and alternately require jQuery or not, depending on whether the shim exists.
The define calls were named due to r.js not transforming the calls with a name, the calls should be:
But r.js should ideally transform that into the first block, or whatever velocity happens to be named in the configuration.
Do you have any insight on this? Is it non-breaking for r.js to be changed to write multiple named define calls? Is it possible to detect if the define calls are in a condition like this?
Thanks!
The text was updated successfully, but these errors were encountered: