mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-03-22 11:08:10 +00:00
this should work
This commit is contained in:
@@ -14,8 +14,9 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build && node scripts/compileAssets.js",
|
||||
"preview": "vite preview",
|
||||
"preview": "vite preview --port 8000",
|
||||
"compileAssets": "node scripts/compileAssets.js --dev",
|
||||
|
||||
"lint": "eslint --fix",
|
||||
"lint:dry": "eslint",
|
||||
"stylelint": "stylelint --fix **/*.{less}",
|
||||
|
||||
@@ -10,7 +10,7 @@ async function start() {
|
||||
|
||||
if (!isProd) {
|
||||
vite = await createViteServer({
|
||||
server: { middlewareMode: 'html' },
|
||||
server: { middlewareMode: true },
|
||||
appType: "custom",
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@ export default defineConfig({
|
||||
outDir: "build",
|
||||
emptyOutDir: true,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
admin: path.resolve(__dirname, "client/admin/admin.jsx"),
|
||||
homebrew: path.resolve(__dirname, "client/homebrew/homebrew.jsx"),
|
||||
},
|
||||
output: {
|
||||
entryFileNames: "[name]/bundle.js",
|
||||
chunkFileNames: "[name]/[name]-[hash].js",
|
||||
|
||||
Reference in New Issue
Block a user