-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pacinor
committed
Apr 9, 2024
1 parent
8d2f48d
commit 3fa2a2c
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { build, createServer } from 'vite' | ||
|
||
/** | ||
* @type {(server: import('vite').ViteDevServer) => Promise<import('rollup').RollupWatcher>} | ||
*/ | ||
function watchPreload(server) { | ||
return build({ | ||
configFile: 'packages/preload/vite.config.ts', | ||
mode: 'development', | ||
plugins: [ | ||
{ | ||
name: 'electron-preload-watcher', | ||
writeBundle() { | ||
server.ws.send({ type: 'full-reload' }) | ||
}, | ||
}, | ||
], | ||
build: { | ||
watch: true, | ||
}, | ||
}) | ||
} | ||
|
||
// bootstrap | ||
const server = await createServer({ | ||
configFile: 'packages/renderer/vite.config.ts', | ||
}) | ||
|
||
await server.listen() | ||
await watchPreload(server) |