Fix 'undefined module' error in lib/browser.js

Browsers complain when lib/browser.js is included, because `module` is undefined. Add type checking to resolve this.