Skip to content

Commit a9c52c1

Browse files
committed
fix: resolve two remaining Vercel build failures
1. app/layout.tsx: strip surrounding quotes from NEXT_PUBLIC_SITE_URL Environment variable was configured with extra double-quotes (e.g. '"https://involutionhell.com"'), causing new URL() to throw ERR_INVALID_URL at page-data collection time. 2. lib/source.ts: eagerly resolve fumadocs-mdx lazy files function fumadocs-mdx@11.x returns `files` as a lazy function in toFumadocsSource(), but fumadocs-core@15.8.x buildContentStorage calls files.map() directly expecting an array. Mutate the source object before passing to loader() to bridge the incompatibility. https://claude.ai/code/session_01YGNupgHxmKvUdpX1x72xjR
1 parent 9c18c20 commit a9c52c1

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

app/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ const geistMono = localFont({
2323
weight: "100 900",
2424
});
2525

26-
const SITE_URL =
27-
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.com";
26+
const SITE_URL = (
27+
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.com"
28+
).replace(/^["']|["']$/g, "");
2829
const en_description =
2930
"内卷地狱(Involution Hell)是一个由开发者发起的开源学习社区,专注算法、系统设计、工程实践与技术分享,帮助华人程序员高效成长,专注真实进步。Involution Hell is an open-source community empowering builders with real-world engineering.";
3031

lib/source.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@ function convertSlugToPinyin(text: string) {
1919
.join("-");
2020
}
2121

22+
// fumadocs-mdx@11.x returns `files` as a lazy function,
23+
// but fumadocs-core@15.8.x buildContentStorage calls files.map() directly.
24+
// Eagerly resolve the files array to maintain compatibility.
25+
const _fumaSource = docs.toFumadocsSource();
26+
if (typeof _fumaSource.files === "function") {
27+
(_fumaSource as { files: unknown }).files = (
28+
_fumaSource.files as () => unknown[]
29+
)();
30+
}
31+
2232
export const source = loader({
2333
baseUrl: "/docs",
24-
source: docs.toFumadocsSource(),
34+
source: _fumaSource,
2535
transformers: [
2636
({ storage }) => {
2737
for (const path of storage.getFiles()) {

0 commit comments

Comments
 (0)