Skip to content

Commit e41cbbc

Browse files
author
Dimitri POSTOLOV
authored
fix transformPageOpts with _app.mdx, pageMap was still included even it was removed in transformPageOpts (#1624)
fix `transformPageOpts` with `_app.mdx`, `pageMap` was still included even it was removed in `transformPageOpts`
1 parent aeec6d4 commit e41cbbc

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.changeset/calm-books-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'nextra': patch
3+
---
4+
5+
fix `transformPageOpts` with _app.mdx, `pageMap` was still included even it was removed in `transformPageOpts`

packages/nextra/src/loader.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ async function loader(
234234
headings,
235235
hasJsxInH1,
236236
timestamp,
237+
pageMap,
237238
...(!HAS_UNDERSCORE_APP_MDX_FILE && {
238-
pageMap,
239239
flexsearch,
240240
newNextLinkBehavior // todo: remove in v3
241241
}),
@@ -268,14 +268,17 @@ ${finalResult}
268268
269269
const __nextra_internal__ = globalThis[Symbol.for('__nextra_internal__')] ||= Object.create(null)
270270
__nextra_internal__.Layout = __nextra_layout
271-
__nextra_internal__.pageMap = ${JSON.stringify(pageMap)}
271+
__nextra_internal__.pageMap = ${JSON.stringify(pageOpts.pageMap)}
272272
__nextra_internal__.flexsearch = ${JSON.stringify(flexsearch)}
273273
${
274274
themeConfigImport
275275
? '__nextra_internal__.themeConfig = __nextra_themeConfig'
276276
: ''
277277
}`
278278
}
279+
if (HAS_UNDERSCORE_APP_MDX_FILE) {
280+
delete pageOpts.pageMap
281+
}
279282

280283
const stringifiedPageOpts = JSON.stringify(pageOpts)
281284
const stringifiedChecksum = IS_PRODUCTION

0 commit comments

Comments
 (0)