requirejs fix

This should be fixing problem when RequireJS is used in NodeJS environment i.e. running a jasmine/karma test.
I'm not sure if this is best fix for it but works OK -- let's discuss please.