Change HTML replace to use function as replacement value

This commit is contained in:
G.Ambatte committed 2026-09-28 16:29:34 +13:00
1 parent 515e419968
commit 915109c761
1 file changed
+6 -4
+6 -4
View File
@@ -283,11 +283,13 @@ export default async function createApp(vite) {
const safeProps = JSON.stringify(props).replace(/<(?=\/?script)/ig, '\\u003c'); const safeProps = JSON.stringify(props).replace(/<(?=\/?script)/ig, '\\u003c');
html = html.replace( html = html.replace(
'<head>', '<head>',
`<head>\n` ()=>{
return `<head>\n`
+ `<script id="props">` + `<script id="props">`
+ `window.__INITIAL_PROPS__ = ` + safeProps + `window.__INITIAL_PROPS__ = ${safeProps
+ `</script>\n` }</script>\n${
+ ogMetaTags ogMetaTags}`;
}
); );
return html; return html;