From 4abe080db2b78edc75d3788a87d963724547f21a Mon Sep 17 00:00:00 2001 From: Shubham Palriwala Date: Tue, 19 Mar 2024 15:16:09 +0530 Subject: [PATCH] fix: /api/js endpoint to work on vercel (#2242) --- apps/web/app/api/js/{route.tsx => route.ts} | 1 - apps/web/next.config.mjs | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) rename apps/web/app/api/js/{route.tsx => route.ts} (99%) diff --git a/apps/web/app/api/js/route.tsx b/apps/web/app/api/js/route.ts similarity index 99% rename from apps/web/app/api/js/route.tsx rename to apps/web/app/api/js/route.ts index eb8008003b..f8bcbc4e1f 100644 --- a/apps/web/app/api/js/route.tsx +++ b/apps/web/app/api/js/route.ts @@ -74,6 +74,5 @@ async function handleInit(req: NextRequest) { async function loadAndAppendCode(path: string, append: string): Promise { let jsCode = await fs.readFile(path, "utf-8"); - return jsCode + append; } diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index 221a8b10b7..e21e85a0a4 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -1,7 +1,7 @@ -import { fileURLToPath } from "node:url"; import { createId } from "@paralleldrive/cuid2"; import { withSentryConfig } from "@sentry/nextjs"; import createJiti from "jiti"; +import { fileURLToPath } from "node:url"; const jiti = createJiti(fileURLToPath(import.meta.url)); @@ -20,6 +20,9 @@ const nextConfig = { experimental: { serverComponentsExternalPackages: ["@aws-sdk"], instrumentationHook: true, + outputFileTracingIncludes: { + "app/api/js": ["../../packages/**/*"], + }, }, transpilePackages: ["@formbricks/database", "@formbricks/ee", "@formbricks/ui", "@formbricks/lib"], images: {