0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-22 08:58:11 +00:00

this should work

This commit is contained in:
Víctor Losada Hernández
2026-02-01 21:59:59 +01:00
parent 71bc95251c
commit 741d7762d8
4 changed files with 7 additions and 10 deletions

View File

@@ -574,18 +574,18 @@ export default async function createApp(vite) {
userThemes : req.userThemes
};
console.log('props: ', !!props);
const htmlPath = isProd ? path.resolve('build', 'index.html') : path.resolve('index.html');
let html = fs.readFileSync(htmlPath, 'utf-8');
if(!isProd && vite?.transformIndexHtml) {
html = await vite.transformIndexHtml(req.originalUrl, html);
}
html = html.replace(
'<head>',
`<head><script>window.__INITIAL_PROPS__ = ${JSON.stringify(props)}</script>`
`<head>\n<script id="props" >window.__INITIAL_PROPS__ = ${JSON.stringify(props)}</script>`
);
console.log('html', html);
return html;
};