Skip to content

Commit

Permalink
Merge pull request #232 from electron-vite/v0.28.6
Browse files Browse the repository at this point in the history
V0.28.6
  • Loading branch information
caoxiemeihao authored Apr 21, 2024
2 parents a9dbd69 + 6ae84a9 commit f361cb6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.28.6 (2024-04-21)

- be94383 fix: `ElectronOptions['startup']` definition
- 96905d9 chore: compatible vite@4 resolve node first
- a16fe3c fix: hot-reload compatible vite@4

## 0.28.5 (2024-04-19)

- f325403 chore: update comments
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export interface ElectronOptions {
* @param options options for `child_process.spawn`
* @param customElectronPkg custom electron package name (default: 'electron')
*/
startup: (argv?: string[], options?: import('node:child_process').SpawnOptions) => Promise<void>
startup: (argv?: string[], options?: import('node:child_process').SpawnOptions, customElectronPkg?: string) => Promise<void>
/** Reload Electron-Renderer */
reload: () => void
}) => void | Promise<void>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-electron",
"version": "0.28.5",
"version": "0.28.6",
"description": "Electron 🔗 Vite",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface ElectronOptions {
* @param options options for `child_process.spawn`
* @param customElectronPkg custom electron package name (default: 'electron')
*/
startup: (argv?: string[], options?: import('node:child_process').SpawnOptions) => Promise<void>
startup: (argv?: string[], options?: import('node:child_process').SpawnOptions, customElectronPkg?: string) => Promise<void>
/** Reload Electron-Renderer */
reload: () => void
}) => void | Promise<void>
Expand Down Expand Up @@ -80,7 +80,7 @@ export default function electron(options: ElectronOptions | ElectronOptions[]):
startup,
reload() {
if (process.electronApp) {
server.hot.send({ type: 'full-reload' })
(server.hot || server.ws).send({ type: 'full-reload' })
} else {
startup()
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export function resolveViteConfig(options: ElectronOptions): InlineConfig {
emptyOutDir: false,
},
resolve: {
// @ts-ignore
browserField: false,
conditions: ['node'],
// #98
// Since we're building for electron (which uses Node.js), we don't want to use the "browser" field in the packages.
// It corrupts bundling packages like `ws` and `isomorphic-ws`, for example.
Expand Down

0 comments on commit f361cb6

Please sign in to comment.