copy entire content directory into the standalone build

This commit is contained in:
Kalidou Diagne
2025-06-12 02:03:29 +08:00
parent 3bc5ff2c4e
commit 9123f32a0e
2 changed files with 14 additions and 7 deletions

View File

@@ -127,11 +127,20 @@ export async function getMarkdownFiles(
// Try multiple potential paths where content might be in Vercel
const potentialPaths = [
// Standard development path - check this first
path.resolve(process.cwd(), folderName),
// Vercel standalone build paths
// Vercel standalone build paths (prioritize these since we copy content here)
path.resolve(process.cwd(), ".next", "standalone", folderName),
path.resolve(
process.cwd(),
".next",
"standalone",
"content",
folderName.replace("content/", "")
),
// Standard development path
path.resolve(process.cwd(), folderName),
// Other Vercel paths
path.resolve(process.cwd(), ".next", "server", folderName),
path.resolve(process.cwd(), ".next", folderName),
// Public directory (fallback option)
path.resolve(process.cwd(), "public", folderName),
path.resolve(process.cwd(), ".next", "standalone", "public", folderName),
@@ -142,8 +151,6 @@ export async function getMarkdownFiles(
path.resolve(__dirname, "..", folderName),
path.resolve(__dirname, "..", "..", folderName),
path.resolve(__dirname, "..", "..", "..", folderName),
// Check in .next directory structure
path.resolve(process.cwd(), ".next", folderName),
]
console.log("Trying potential paths:")

View File

@@ -1,8 +1,7 @@
{
"functions": {
"app/api/**": {
"maxDuration": 30,
"includeFiles": "content/**"
"maxDuration": 30
}
},
"regions": ["iad1"],
@@ -11,5 +10,6 @@
"NEXT_TELEMETRY_DISABLED": "1"
}
},
"buildCommand": "next build && cp -r content .next/standalone/",
"crons": []
}