added check for module as well as require for node environment

Hi - thanks for the work on this, it's been a life saver for me this week! Hope this is useful:

When using requireJS in the browser, it attempts to load modules defined
by require(). Not sure if these can be configured to load in browser too
but quick fix is just to add extra check to ensure node environment.