Added `require` to be visible inside factory function (set to real Node.js `require` when used with UMD export). Fixed non-exporting build.