I am trying to port some obsolete js codes to modules so that they can be loaded using RequireJS.
I have three jQuery plugins, let them be called a, b and c.
- Plugin a works with any version of jQuery
- Plugin b works with jQuery version 1.4.2
- The c plugin uses a and b and works with any version of jQuery.
Therefore, at any time when plugin a is required, the downloadable jQuery is version 1.4.2. My require.config looks something like this:
require.config({ paths:{ "jquery": "libs/jquery.1.9.1.min", "jquery1-4-2" : "libs/jquery1.4.2.min" });
And plugins are defined as follows:
plugin a: define(["jquery"], function($){ (...) }); plugin b: define(["jquery1-4-2"], function($){ (...) }); plugin c: define(["jquery", "a","b"], function($){ (...) });
How can I configure this script so that if some plug-in needs a specific version of jQuery, while others do not require a version, then only this specific version is loaded?
Thanks in advance.
source share