From b4c6ef9f868e2e6715a4087296901d20345787b9 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 --- 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';