diff --git a/lib/bn.js b/lib/bn.js index f86d196..c9773da 100644 --- a/lib/bn.js +++ b/lib/bn.js @@ -50,7 +50,11 @@ var Buffer; try { - Buffer = require('buffer').Buffer; + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = require('buffer').Buffer; + } } catch (e) { }