From 442baddf230c3a5333c5dc4e8541f24529c00929 Mon Sep 17 00:00:00 2001 From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:15:53 +0100 Subject: [PATCH] fix(media): remove type import fs/crypto (#461) --- langfuse-core/src/media/LangfuseMedia.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/langfuse-core/src/media/LangfuseMedia.ts b/langfuse-core/src/media/LangfuseMedia.ts index c65eb2d5..a28316e4 100644 --- a/langfuse-core/src/media/LangfuseMedia.ts +++ b/langfuse-core/src/media/LangfuseMedia.ts @@ -1,11 +1,13 @@ -let fs: typeof import("fs") | undefined; -let crypto: typeof import("crypto") | undefined; +let fs: any; +let crypto: any; +// Fail gracefully in environments without fs/crypto support try { fs = require("fs"); + crypto = require("crypto"); } catch { - // Fail gracefully in environments without fs/crypto support fs = undefined; + crypto = undefined; } try {