RequireJS on NodeJS (using amdefine) compatibility.

"he" doesn't correctly exports it's API when used with RequireJS in "node-compatibility mode" as described here: http://requirejs.org/docs/node.html#nodeModules

I changed the order of environment detection logic to prevent amdefine's fake 'define' making wrong decision about AMD environment.