From d2fef404f6c7e4ec5878b76a704a0e0daec5fd05 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Fri, 2 Jun 2017 16:03:19 -0400 Subject: [PATCH] Polyfill global.Buffer when importing the crypto stub. --- map.json | 2 +- wrappers/crypto.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 wrappers/crypto.js diff --git a/map.json b/map.json index 704f1326aa..3aefe0ab1a 100644 --- a/map.json +++ b/map.json @@ -5,7 +5,7 @@ "cluster": null, "console": "console-browserify", "constants": "constants-browserify", - "crypto": "crypto-browserify", + "crypto": "../wrappers/crypto.js", "core-util-is": null, "dgram": null, "dns": null, diff --git a/wrappers/crypto.js b/wrappers/crypto.js new file mode 100644 index 0000000000..206074a0af --- /dev/null +++ b/wrappers/crypto.js @@ -0,0 +1,2 @@ +global.Buffer = global.Buffer || require("buffer").Buffer; +module.exports = require("crypto-browserify");