mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-25 13:42:57 +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);
|
||||
}
|
||||
|
||||
const safeProps = JSON.stringify(props).replace(/<(?=\/?script)/ig, '\\u003c');
|
||||
html = html.replace(
|
||||
'<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;
|
||||
|
||||
Reference in New Issue
Block a user