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