Export to module.exports if it exists, even if window exists too. Lets it work with browserify. Seems to build fine and passes tests.