Skip to content

Commit e6787c7

Browse files
committed
v0.29.0
1 parent 638d0f3 commit e6787c7

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
## 0.29.0 (2024-11-16)
2+
3+
- 638d0f3 feat: support main process control hot-reload
4+
- c58fbf9 feat: mock index.html for support use the main process only
5+
6+
**Hot Reload**
7+
8+
Since `v0.29.0`, when preload scripts are rebuilt, they will send an `electron-vite&type=hot-reload` event to the main process.
9+
If your App doesn't need a renderer process, this will give you **hot-reload**.
10+
11+
```js
12+
// electron/main.ts
13+
14+
process.on('message', (msg) => {
15+
if (msg === 'electron-vite&type=hot-reload') {
16+
for (const win of BrowserWindow.getAllWindows()) {
17+
// Hot reload preload scripts
18+
win.webContents.reload()
19+
}
20+
}
21+
})
22+
```
23+
124
## 0.28.8 (2024-09-19)
225

326
- 3239718 fix: better exit app #251

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,24 @@ build({
246246
})
247247
```
248248

249+
**Hot Reload**
250+
251+
Since `v0.29.0`, when preload scripts are rebuilt, they will send an `electron-vite&type=hot-reload` event to the main process.
252+
If your App doesn't need a renderer process, this will give you **hot-reload**.
253+
254+
```js
255+
// electron/main.ts
256+
257+
process.on('message', (msg) => {
258+
if (msg === 'electron-vite&type=hot-reload') {
259+
for (const win of BrowserWindow.getAllWindows()) {
260+
// Hot reload preload scripts
261+
win.webContents.reload()
262+
}
263+
}
264+
})
265+
```
266+
249267
## How to work
250268

251269
It just executes the `electron .` command in the Vite build completion hook and then starts or restarts the Electron App.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-electron",
3-
"version": "0.28.8",
3+
"version": "0.29.0",
44
"description": "Electron 🔗 Vite",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -26,7 +26,7 @@
2626
"type": "git",
2727
"url": "git+https://github.com/electron-vite/vite-plugin-electron.git"
2828
},
29-
"author": "草鞋没号 <[email protected]>",
29+
"author": "Leo Wang(草鞋没号) <[email protected]>",
3030
"license": "MIT",
3131
"packageManager": "[email protected]",
3232
"scripts": {

0 commit comments

Comments
 (0)