Change Browser/NodeJS detection to look for module.exports instead of window

If you use Swig with [Node-Webkit](https://github.com/rogerwang/node-webkit) (runs NodeJS modules inside Webkit) then Swig will not let you use swig.compileFile().

This is because Swig is currently checking if `window` exists. This is fine for most cases - but in Node-Webkit `window` does exist!

I've simply changed it to make sure `module.exports` does exist.