upstream #1
| @@ -48,8 +48,6 @@ export async function getFileBySlug(type, slug) { | ||||
|     ? fs.readFileSync(mdxPath, 'utf8') | ||||
|     : fs.readFileSync(mdPath, 'utf8') | ||||
|  | ||||
|   const { data, content } = matter(source) | ||||
|  | ||||
|   // https://github.com/kentcdodds/mdx-bundler#nextjs-esbuild-enoent | ||||
|   if (process.platform === 'win32') { | ||||
|     process.env.ESBUILD_BINARY_PATH = path.join( | ||||
| @@ -68,7 +66,7 @@ export async function getFileBySlug(type, slug) { | ||||
|     ) | ||||
|   } | ||||
|  | ||||
|   const { code } = await bundleMDX(source, { | ||||
|   const { frontmatter, code } = await bundleMDX(source, { | ||||
|     // mdx imports can be automatically source from the components directory | ||||
|     cwd: path.join(process.cwd(), 'components'), | ||||
|     xdmOptions(options) { | ||||
| @@ -114,10 +112,10 @@ export async function getFileBySlug(type, slug) { | ||||
|   return { | ||||
|     mdxSource: code, | ||||
|     frontMatter: { | ||||
|       readingTime: readingTime(content), | ||||
|       readingTime: readingTime(code), | ||||
|       slug: slug || null, | ||||
|       fileName: fs.existsSync(mdxPath) ? `${slug}.mdx` : `${slug}.md`, | ||||
|       ...data, | ||||
|       ...frontmatter, | ||||
|     }, | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user