Quick code answer is below. Something somewhere (presumably in Durandal) is making jQuery available without any modules that use it having to declare it as a dependency (I guess there's a define statement somewhere in Durandal code but without a specific sample it's hard to realise this. I guess very few people out there are using jQuery or plug-ins (sarcasm)). Hopefully John Papa's upcoming "Hot Towel" course will deal with some of these questions/issues. And not just jQuery itself but plug-ins too.
**The trick to solving the jQuery plugin problem, which is the real problem behind all the questions my team were asking, is the following command at the start of the main.js file pointed to by the script reference to requireJS:
require.config({
paths: {
'text': 'durandal/amd/text',
'mockjson': '../Scripts/jquery.mockjson.js'
},
shim: {
'mockjson': {
deps: ['jquery'],
exports: ['mockJSON']
}
}
});
Notice that mockJSON library will need to be added to a bundle (I used 'vendor' but you could add a new bundle) and that they key point here is that as it's a jQuery plugin you should not declare it as a dependency in any of your modules that require it (or at least that's what works for me).
Sorry for the length of the original questions but the reality is I have a team who want answers to these questions, can't find them on the web and at the time of writing only have the Code Camper app from John Papa to go on - an app which has a great course and is a great starting point if you want to write a lot of plumbing code to wire various libraries together (We don't. We need to be productive, although the code is a great way to UNDERSTAND what newer frameworks like Durandal are coding up for you through a much simpler 'convention over coding' approach). The problem with that course for our team is that when you dig into the code, you end up having more questions than you find answers to (eg "Why when I move libraries into their own sub-folders instead of everything in one big folder does requireJS throw out an error that says "You're loading libraries behind my back. Let me do it and don't do it behind my back", "Why does the code seem to get away with using some libraries that aren't in bundles and which a search for only shows as being in a 'more.info.txt' file whose usage/intention is never explained?"; "Why have module naming conventions that differ between a dot delimiter and a slash delimiter for no apparent reason (or at least one that's never explained?" "Why are there references in bundles to script files that aren't there in the solution (is it just unused debris not removed during evolution of the app)?" "Why has the author moved the NetEye IsBusy indicator library outside of its own library and renamed it as a script in his own 'KoLite' library?" etc etc
I'm sorry that Ward apparently doesn't think trying to UNDERSTAND how these things fit together and are working is important (which is why I asked the five questions I did - questions my whole team are asking and aren't explained in any of the 'cut and paste' answers around jquery and require we found on the web). As a trainer I'd have expected him to understand that 'give me some cut and past code from a Pluralsight course that isn't really relevant. I don't need to understand it' wasn't what I was trying to do here and sometimes if the available material doesn't answer a whole heap of questions a whole group of people are struggling with then it makes sense to try and explain what it is you don't understand. My bad!
I guess there's an opportunity here for someone to write a decent requireJS course ;-)