Fix check for a global variable "module"

The simple check for module assumes that a global module variable exists, which is not the case if the browser just has an global exports variable and not a global module variable

also the tests on master currently fail (at least for me locally)