🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore(storybook): Fix prisma dependency issues (#14591)
Ben Bachem425b91c3c66f
diff --git a/web/.storybook/main.ts b/web/.storybook/main.tsindex 9d7ab008d4..ece4fdc5cc 100644--- a/web/.storybook/main.ts+++ b/web/.storybook/main.ts@@ -37,6 +37,10 @@ const config: StorybookConfig = {dirname(fileURLToPath(import.meta.url)),"../../packages/shared/src",);+ const prismaBrowserStub = resolve(+ dirname(fileURLToPath(import.meta.url)),+ "./prisma-browser-stub.cjs",+ );viteConfig.resolve = viteConfig.resolve ?? {};// Use the array form with regex `find`s for *exact* matching. The object// form is treated by Vite/Rollup as a literal prefix replacement, so an@@ -54,6 +58,10 @@ const config: StorybookConfig = {replacement: replacement as string,}));viteConfig.resolve.alias = [+ {+ find: /^\.prisma\/client\/index-browser$/,+ replacement: prismaBrowserStub,+ },{find: /^@langfuse\/shared\/src\/(.*)$/,replacement: `${sharedSrc}/$1`,diff --git a/web/.storybook/prisma-browser-stub.cjs b/web/.storybook/prisma-browser-stub.cjsnew file mode 100644index 0000000000..d5feeb2ca6--- /dev/null+++ b/web/.storybook/prisma-browser-stub.cjs@@ -0,0 +1,37 @@+const fail = () => {+ throw new Error(+ "Prisma is server-only and must not be used in Storybook browser stories.",+ );+};++const enumLike = new Proxy(+ {},+ {+ get: (_target, prop) => (typeof prop === "symbol" ? undefined : String(prop)),+ getOwnPropertyDescriptor: (_target, prop) => ({+ configurable: true,+ enumerable: true,+ value: String(prop),+ }),+ ownKeys: () => ["PLACEHOLDER"],+ },+);++const PrismaClient = new Proxy(function PrismaClient() {}, {+ apply: fail,+ construct: fail,+});++module.exports = new Proxy(+ {},+ {+ get: (_target, prop) => {+ if (prop === "__esModule") return false;+ if (prop === "default") return undefined;+ if (prop === "PrismaClient") return PrismaClient;+ if (typeof prop === "symbol") return undefined;++ return enumLike;+ },+ },+);