Make this RequireJS compatible.
Be a little more strict in the check for whether 'define' exists.