Add undefined check for module for Node/Browserify exporting