Add basic compatibility with browserify and webpack

On the compile step, both window and module are defined. Gun prevents module exports by detecting the environment and tacking Gun onto the window object. This addition will check to see if it's a dual environment (like browserify or electron) and export to both window and module, preventing errors in your build step.
This commit is contained in:
Jesse Gibson 2015-11-23 15:32:48 -07:00
parent 2540f32774
commit f6f7310a50

3
gun.js
View File

@ -980,6 +980,9 @@
}({}));
if(typeof window !== "undefined"){
window.Gun = Gun;
if(typeof module !== 'undefined' && module.exports){
module.exports = Gun;
}
} else {
module.exports = Gun;
}