We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Buffer
1 parent 80b7f29 commit 1234307Copy full SHA for 1234307
buffer.js
@@ -0,0 +1,12 @@
1
+// See https://github.com/stellar/js-xdr/issues/117
2
+import { Buffer } from 'buffer';
3
+
4
+if (!(Buffer.alloc(1).subarray(0, 1) instanceof Buffer)) {
5
+ Buffer.prototype.subarray = function subarray(start, end) {
6
+ const result = Uint8Array.prototype.subarray.call(this, start, end);
7
+ Object.setPrototypeOf(result, Buffer.prototype);
8
+ return result;
9
+ };
10
+}
11
12
+export default Buffer;
webpack.config.js
@@ -47,7 +47,7 @@ module.exports = function () {
47
};
48
config.plugins.push(
49
new webpack.ProvidePlugin({
50
- Buffer: ['buffer', 'Buffer']
+ Buffer: [path.resolve(__dirname, 'buffer.js'), 'default']
51
})
52
);
53
} else {
0 commit comments