The following throws and error "module is not defined" in a browser. Why and how can I avoid the error given that I cannot be sure ahead of time that module will be defined?
;(function() {
    var version = '0.0.1';
    /**
     * This file needs to work in
     * both NodeJS and browsers.
     */
    if (module) {
        module.exports = version;
    } else {
        define(function() {
            return version;
        });
    }
}());
 
    