mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-25 15:52:58 +00:00
replace </?script in json
This commit is contained in:
+6
-1
@@ -280,9 +280,14 @@ export default async function createApp(vite) {
|
|||||||
html = await vite.transformIndexHtml(req.originalUrl, html);
|
html = await vite.transformIndexHtml(req.originalUrl, html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const safeProps = JSON.stringify(props).replace(/<(?=\/?script)/ig, '\\u003c');
|
||||||
html = html.replace(
|
html = html.replace(
|
||||||
'<head>',
|
'<head>',
|
||||||
()=>{ return `<head>\n<script id="props" >window.__INITIAL_PROPS__ = ${JSON.stringify(props)}</script>\n${ogMetaTags}`; }
|
`<head>\n`
|
||||||
|
+ `<script id="props">`
|
||||||
|
+ `window.__INITIAL_PROPS__ = ` + safeProps
|
||||||
|
+ `</script>\n`
|
||||||
|
+ ogMetaTags
|
||||||
);
|
);
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
Reference in New Issue
Block a user