Ok, now to the CRM 2011 context…
Deploy RequireJS as a web resource and add it to your form, then add another web resource to the form that contains your “View Model” for the form:
In my case the “View Model” resource is called dkdt_/scripts/requirejsttest.js. Make sure you’ve wired up the form to call the starting function in your web resource. In my case the function is called dkdt_OnLoad. Here’s the code for the requirejstest.js web resource:
The source code for the somerequiredscript.js web resource looks like:
The only consistent way I could figure out to tell RequireJS to load the right web resource was to build the full url programmatically. If you know of a better way, let me know in the comments.