const basePath = "/docedit"; // prefix ระดับแอปของ judes-note ใน route tree (app/note/**) + statics (public/note/**) // — basePath /docedit เป็นของกลางแชร์กับแอปพี่น้อง (เช่น wordaddin ในอนาคต) // URL ปลายทางจึงยังเป็น /docedit/note/… เหมือนเดิมทุกจุด const appPath = "/note"; /** @type {import('next').NextConfig} */ const nextConfig = { // สำหรับ Docker (docker/web.Dockerfile) — build แล้วได้ .next/standalone รันด้วย node server.js output: "standalone", // serve ใต้ /docedit + route ทั้งหมดอยู่ใต้ app/note/** — /next/navigation เติม basePath // ให้เอง แต่ต้องเขียน path รวม /note (เช่น href="/note/login") ส่วน fetch/EventSource/ // plain /workerSrc ต้องผ่าน withBasePath() (utils/base-path.ts — เติม base + /note) basePath, // expose ให้โค้ดใช้ (inline ตอน build) — ค่าจริงประกาศที่เดียวที่ไฟล์นี้ env: { NEXT_PUBLIC_BASE_PATH: basePath, NEXT_PUBLIC_APP_PATH: appPath }, // เข้า /docedit/ ตรง ๆ (ไม่มี route ที่ root) → โผล่ที่หน้ารายการของ /note // (Next เติม basePath ให้ source/destination เอง + query ส่งต่ออัตโนมัติ — รองรับ /docedit/?fileUrl=…) async redirects() { return [{ source: "/", destination: appPath, permanent: false }]; }, // N4 อัปโหลดไฟล์ผ่าน Server Action — default 1MB ไม่พอสำหรับ PDF/สแกนศาล (ต้องตรงกับ MAX_UPLOAD_BYTES ใน app/actions/files.ts) experimental: { serverActions: { bodySizeLimit: "100mb", }, }, }; export default nextConfig;