diff --git a/src/middleware.ts b/src/middleware.ts index e66a85c015..c7d3ebcb86 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,13 +6,25 @@ const isProtectedRoute = createRouteMatcher([ '/api(.*)', ]); -export default clerkMiddleware(async (auth, req) => { - if (isProtectedRoute(req)) { - await auth.protect(); - } -}); +export default clerkMiddleware( + async (auth, req) => { + if (isProtectedRoute(req)) { + await auth.protect(); + } + }, + { debug: true }, +); // Also exclude tunnelRoute used in Sentry from the matcher. +// export const config = { +// matcher: ['/((?!.+\\.[\\w]+$|_next|monitoring).*)', '/', '/(api|trpc)(.*)'], +// }; + export const config = { - matcher: ['/((?!.+\\.[\\w]+$|_next|monitoring).*)', '/', '/(api|trpc)(.*)'], + matcher: [ + // Skip Next.js internals and all static files, unless found in search params. + '/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)', + // Always run for API routes. + '/(api|trpc)(.*)', + ], }; diff --git a/tsconfig.json b/tsconfig.json index 802fabeb83..7d1121766e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,3 @@ -/* eslint-disable jsonc/sort-keys */ { "compilerOptions": { "lib": ["dom", "dom.iterable", "esnext"], @@ -11,7 +10,6 @@ "alwaysStrict": true, "strictNullChecks": true, "noUncheckedIndexedAccess": true, - "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, @@ -19,39 +17,26 @@ "noUnusedParameters": true, "allowUnreachableCode": false, "noFallthroughCasesInSwitch": true, - "target": "es2017", "outDir": "out", "sourceMap": true, - "esModuleInterop": true, "allowSyntheticDefaultImports": true, "allowJs": true, "checkJs": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "jsx": "preserve", "noEmit": true, "isolatedModules": true, "incremental": true, - - // Load types "types": ["vitest/globals"], - - // Path aliases "baseUrl": ".", "paths": { "@/*": ["./src/*"], "@/public/*": ["./public/*"] }, - - // Editor support - "plugins": [ - { - "name": "next" - } - ] + "plugins": [{ "name": "next" }] }, "exclude": [ "./out/**/*", @@ -61,10 +46,11 @@ "**/*.e2e.ts" ], "include": [ + "**/*.mts", "**/*.ts", "**/*.tsx", - "**/*.mts", + ".storybook/*.ts", "next-env.d.ts", - ".storybook/*.ts" + ".next/types/**/*.ts" ] }