I have a project which utilizes multiple require contexts and dynamically loaded jQuery versions and plugins. (The jQuery versions will be centrally sourced and will not be inlined). jQuery integrity for the host and each context as well as plugin isolation are critical.
I am writing a loader plugin for RequireJS to handle the following use cases:
- Within a specific require context
- And without affecting the fn of the hosting page or any other require context, I would like to:
- Load any version of jQuery I need
- Load plugins onto the fn of my specific jQuery version
- Have referential integrity on a required jQuery version such that any module within my require context can share plugins
I have an example project for the loader with tests here.
It is failing on the last condition when I make a second call using the loader, it is blowing away the prior version.
I am also using eval to isolate the the $ references in the loaded plugins to the locally loaded jQuery version scope. Any thoughts on a better way to do this would be appreciated.
Want to Keep it Simple (Stupid) if there's an easier/cleaner solution.
Thanks, much.