From 432d5e6e28f8e7c22546ba60ce7ae56b416766bc Mon Sep 17 00:00:00 2001 From: shadcn Date: Thu, 7 Nov 2024 17:45:34 +0400 Subject: [PATCH] fix: code view for mdx --- apps/www/lib/rehype-component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/www/lib/rehype-component.ts b/apps/www/lib/rehype-component.ts index 40451f56cb..17dd2a0b16 100644 --- a/apps/www/lib/rehype-component.ts +++ b/apps/www/lib/rehype-component.ts @@ -106,10 +106,10 @@ export function rehypeComponent() { try { for (const style of styles) { const component = Index[style.name][name] - const src = component.files[0] + const src = component.files[0]?.path // Read the source file. - const filePath = path.join(process.cwd(), src) + const filePath = src let source = fs.readFileSync(filePath, "utf8") // Replace imports.