Commit 753f35b 1 parent 6174362 commit 753f35b Copy full SHA for 753f35b
File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const getDefaultRoute = (): Route => ({
29
29
} )
30
30
31
31
interface PageModule {
32
- __pageData : string
32
+ __pageData : PageData
33
33
default : Component
34
34
}
35
35
@@ -77,8 +77,8 @@ export function createRouter(
77
77
route . path = inBrowser ? pendingPath : withBase ( pendingPath )
78
78
route . component = markRaw ( comp )
79
79
route . data = import . meta. env . PROD
80
- ? markRaw ( JSON . parse ( __pageData ) )
81
- : ( readonly ( JSON . parse ( __pageData ) ) as PageData )
80
+ ? markRaw ( __pageData )
81
+ : ( readonly ( __pageData ) as PageData )
82
82
83
83
if ( inBrowser ) {
84
84
nextTick ( ( ) => {
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export async function renderPage(
60
60
const { __pageData } = await import (
61
61
pathToFileURL ( path . join ( config . tempDir , pageServerJsFileName ) ) . toString ( )
62
62
)
63
- pageData = JSON . parse ( __pageData )
63
+ pageData = __pageData
64
64
} catch ( e ) {
65
65
if ( page === '404.md' ) {
66
66
hasCustom404 = false
Original file line number Diff line number Diff line change @@ -169,9 +169,9 @@ const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/
169
169
const namedDefaultExportRE = / ( (?: ^ | \n | ; ) \s * ) e x p o r t ( .+ ) a s ( \s * ) d e f a u l t /
170
170
171
171
function genPageDataCode ( tags : string [ ] , data : PageData ) {
172
- const code = `\nexport const __pageData = ${ JSON . stringify (
172
+ const code = `\nexport const __pageData = JSON.parse( ${ JSON . stringify (
173
173
JSON . stringify ( data )
174
- ) } `
174
+ ) } ) `
175
175
176
176
const existingScriptIndex = tags . findIndex ( ( tag ) => {
177
177
return (
You can’t perform that action at this time.
0 commit comments