Skip to content

Commit

Permalink
v0.29.0
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxiemeihao committed Nov 16, 2024
1 parent 638d0f3 commit e6787c7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 0.29.0 (2024-11-16)

- 638d0f3 feat: support main process control hot-reload
- c58fbf9 feat: mock index.html for support use the main process only

**Hot Reload**

Since `v0.29.0`, when preload scripts are rebuilt, they will send an `electron-vite&type=hot-reload` event to the main process.
If your App doesn't need a renderer process, this will give you **hot-reload**.

```js
// electron/main.ts

process.on('message', (msg) => {
if (msg === 'electron-vite&type=hot-reload') {
for (const win of BrowserWindow.getAllWindows()) {
// Hot reload preload scripts
win.webContents.reload()
}
}
})
```

## 0.28.8 (2024-09-19)

- 3239718 fix: better exit app #251
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@ build({
})
```

**Hot Reload**

Since `v0.29.0`, when preload scripts are rebuilt, they will send an `electron-vite&type=hot-reload` event to the main process.
If your App doesn't need a renderer process, this will give you **hot-reload**.

```js
// electron/main.ts

process.on('message', (msg) => {
if (msg === 'electron-vite&type=hot-reload') {
for (const win of BrowserWindow.getAllWindows()) {
// Hot reload preload scripts
win.webContents.reload()
}
}
})
```

## How to work

It just executes the `electron .` command in the Vite build completion hook and then starts or restarts the Electron App.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-electron",
"version": "0.28.8",
"version": "0.29.0",
"description": "Electron 🔗 Vite",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -26,7 +26,7 @@
"type": "git",
"url": "git+https://github.com/electron-vite/vite-plugin-electron.git"
},
"author": "草鞋没号 <[email protected]>",
"author": "Leo Wang(草鞋没号) <[email protected]>",
"license": "MIT",
"packageManager": "[email protected]",
"scripts": {
Expand Down

0 comments on commit e6787c7

Please sign in to comment.