From b6cae7e13f4f29c331657fa8b676f8b1e20b0fea Mon Sep 17 00:00:00 2001 From: Artur Date: Fri, 18 Mar 2022 14:44:18 +0200 Subject: [PATCH] Make compatible with Vite Fixes #195 Signed-off-by: Artur Signell --- packages/rsocket-core/src/LiteBuffer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/rsocket-core/src/LiteBuffer.js b/packages/rsocket-core/src/LiteBuffer.js index f9cdc772..04b61cfc 100644 --- a/packages/rsocket-core/src/LiteBuffer.js +++ b/packages/rsocket-core/src/LiteBuffer.js @@ -6,7 +6,11 @@ import ExistingBufferModule from 'buffer'; const hasGlobalBuffer = typeof global !== 'undefined' && global.hasOwnProperty('Buffer'); -const hasBufferModule = ExistingBufferModule.hasOwnProperty('Buffer'); +let hasBufferModule = false; +try { + hasBufferModule = ExistingBufferModule.hasOwnProperty('Buffer'); +} catch (e) { +} function notImplemented(msg?: string): void { const message = msg ? `Not implemented: ${msg}` : 'Not implemented';