Skip to content

Commit

Permalink
fix: replace last 'export default MDXContent;' (#2045)
Browse files Browse the repository at this point in the history
Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
soata and dimaMachina committed Jul 8, 2023
1 parent 8127454 commit 23a25b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/real-games-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra': patch
---

replace last match of `export default MDXContent;`
5 changes: 4 additions & 1 deletion packages/nextra/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ const __nextraPageOptions = {
(themeConfigImport && 'themeConfig: __nextra_themeConfig')
}
}
${finalResult.replace('export default MDXContent;', '')}
${
// Remove the last match of `export default MDXContent` because it can be existed in the raw MDX file
finalResult.slice(0, finalResult.lastIndexOf('export default MDXContent;'))
}
if (process.env.NODE_ENV !== 'production') {
__nextraPageOptions.hot = module.hot
__nextraPageOptions.pageOptsChecksum = ${stringifiedChecksum}
Expand Down

1 comment on commit 23a25b1

@vercel
Copy link

@vercel vercel bot commented on 23a25b1 Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.