Fixing accidental detection of require.js as common js

I changed to code to check for common js by looking for exports and module instead. Also, would it be possible to require fs inside the function where it's used?
Merge pull request #16 from nathanathan/patch-2

Fixing accidental detection of require.js as common js