diff --git a/apps/www/lib/rehype-component.ts b/apps/www/lib/rehype-component.ts index 17dd2a0b16..0a3b0ed1a3 100644 --- a/apps/www/lib/rehype-component.ts +++ b/apps/www/lib/rehype-component.ts @@ -42,12 +42,12 @@ export function rehypeComponent() { file.endsWith(`${fileName}.tsx`) || file.endsWith(`${fileName}.ts`) ) - }) || component.files[0] - : component.files[0] + }) || component.files[0]?.path + : 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.