Support for CommonJS (browserify/node) modules

Fixes #499, but could affect others. Changes the factory function to add a case
for CommonJS, and fixes package.json to point to the proper JS file.
Merge pull request #501 from suy/commonjs

Support for CommonJS (browserify/node) modules