fix: isolate detect-user-language from client bundle
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m33s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m33s
Remove detectUserLanguage re-export from i18n barrel index.ts — it depends on next/headers (server-only) and was being pulled into client component bundles via sidebar.tsx → lib/i18n/index.ts, causing build failure. Add 'server-only' guard to detect-user-language.ts to make the constraint explicit.
This commit is contained in:
@@ -5,11 +5,15 @@
|
||||
* 1. Most common language among user's notes (DB GROUP BY)
|
||||
* 2. Browser language hint (passed from server component via Accept-Language)
|
||||
* 3. Default: 'en'
|
||||
*
|
||||
* SERVER ONLY — uses next/headers and Prisma. Never import from client components.
|
||||
*/
|
||||
import 'server-only'
|
||||
|
||||
import { auth } from '@/auth'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { unstable_cache, cookies } from 'next/cache'
|
||||
import { unstable_cache } from 'next/cache'
|
||||
import { cookies } from 'next/headers'
|
||||
import { SupportedLanguage } from './load-translations'
|
||||
|
||||
const SUPPORTED_LANGUAGES = new Set(['en', 'fr', 'es', 'de', 'fa', 'it', 'pt', 'ru', 'zh', 'ja', 'ko', 'ar', 'hi', 'nl', 'pl'])
|
||||
|
||||
Reference in New Issue
Block a user