Adding new requirejs support (untested)

Hi James,

I did not have enough time to test this, but it should work.

cheers,
Muki