mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-23 18:17:44 +02:00
fix(desktop): restructure to standard electron-vite layout for HMR
- Move renderer files to src/renderer/src/ (electron-vite standard) - Move index.html to src/renderer/ - Remove root: '.' config that broke HMR - Use ELECTRON_RENDERER_URL instead of VITE_DEV_SERVER_URL - Update tsconfig paths for new structure This fixes hot module replacement not working after the monorepo restructure. The previous non-standard directory layout with root: '.' caused electron-vite's HMR to fail silently. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,18 +18,10 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
renderer: {
|
||||
root: '.',
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: {
|
||||
index: path.resolve(__dirname, 'index.html'),
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src'),
|
||||
'@': path.resolve(__dirname, 'src/renderer/src'),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -55,7 +55,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
// APP_ROOT points to apps/desktop (two levels up from out/main/)
|
||||
process.env.APP_ROOT = path.join(__dirname, '../..')
|
||||
|
||||
export const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL']
|
||||
// electron-vite uses ELECTRON_RENDERER_URL for dev server
|
||||
export const VITE_DEV_SERVER_URL = process.env['ELECTRON_RENDERER_URL']
|
||||
// electron-vite outputs to out/ directory
|
||||
export const MAIN_DIST = path.join(__dirname)
|
||||
export const RENDERER_DIST = path.join(__dirname, '../renderer')
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
<script type="module" src="./src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -15,7 +15,7 @@
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@/*": ["./src/renderer/src/*"],
|
||||
"@multica/ui/*": ["../../packages/ui/src/*"],
|
||||
"@multica/store/*": ["../../packages/store/src/*"]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user