feat(plugin-vite): enable main process hot restart via exported API#4168
Closed
bglgwyng wants to merge 52 commits intoelectron:nextfrom
Closed
feat(plugin-vite): enable main process hot restart via exported API#4168bglgwyng wants to merge 52 commits intoelectron:nextfrom
bglgwyng wants to merge 52 commits intoelectron:nextfrom
Conversation
Bumps [actions/stale](https://github.com/actions/stale) from 10.0.0 to 10.1.0. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](actions/stale@3a9db7e...5f858e3) --- updated-dependencies: - dependency-name: actions/stale dependency-version: 10.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…on#4042) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 5.0.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@ea165f8...330a01c) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…tron#4041) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@634f93c...018cc2c) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4040) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.6.0 to 6.0.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@a26af69...e797f83) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.4.0 to 6.0.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@49933ea...2028fbc) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@08c6903...1af3b93) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4063) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@e797f83...83679a8) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
electron#4077) This reverts commit 1e1050f.
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.3.1 to 1.3.2. - [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md) - [Commits](digitalbazaar/forge@v1.3.1...v1.3.2) --- updated-dependencies: - dependency-name: node-forge dependency-version: 1.3.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* first pass * chmod +x
* docs: add `next` README notice Added important notice about upcoming feature development and pre-releases. * zzz
* fix(template): add `private: true` * add regression tests
Bumps [jws](https://github.com/brianloveswords/node-jws) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/brianloveswords/node-jws/releases) - [Changelog](https://github.com/auth0/node-jws/blob/master/CHANGELOG.md) - [Commits](auth0/node-jws@v4.0.0...v4.0.1) --- updated-dependencies: - dependency-name: jws dependency-version: 4.0.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* test(slow): test api against `file:` protocol fixtures (electron#4087) * test(slow): simplify bootstrapping tests (electron#4096) * test: use verdaccio for e2e init testing (electron#4100) * zzz * gg
…tron#4110) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@018cc2c...37930b1) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…on#4111) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@330a01c...b7c566a) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v6...395ad32) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v6...8e8c483) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4.3.0 to 5.0.1. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@0057852...9255dc7) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 5.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* test(import): use verdaccio * remove fixtures * move fuses to verdaccio too...
<trigger_release>
* fix: apply correct version bump commit title * Revert "chore: version bump (electron#4120)" This reverts commit 4c32ab9.
<trigger_release>
* Revert "chore: bump version to 7.11.0 (electron#4123)" This reverts commit fa6672a. * chore: use yarn `workspace:*` cross-references (electron#4056) * i don't think we need to initlink anymore because we're publishing to verdaccio * add install deps command back in * fix lockfile * another approach
<trigger_release>
<trigger_release>
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.1 to 5.0.3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@9255dc7...cdf6c1f) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 5.0.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
BlackHole1
reviewed
Mar 16, 2026
erickzhao
approved these changes
Mar 19, 2026
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.2.7 to 3.4.1. - [Commits](WebReflection/flatted@v3.2.7...v3.4.1) --- updated-dependencies: - dependency-name: flatted dependency-version: 3.4.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
BlackHole1
previously approved these changes
Mar 23, 2026
Add restartApp()/onAppRestart() to @electron-forge/core-utils as an explicit API for triggering Electron app restarts. The Vite plugin calls restartApp() in its closeBundle hook when the main process bundle is rebuilt. The start API registers the actual restart logic via onAppRestart(). Also backport the duplicate restart guard (!lastSpawned.restarted) to the stdin handler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The stdin 'rs' handler now calls restartApp() instead of duplicating the kill→respawn logic, so all restart requests flow through the single onAppRestart callback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevent unnecessary terminal cursor manipulation when the Electron app has not been spawned yet. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6c0c50e to
76aceb1
Compare
Author
|
Do we need more approvals to merge this PR? |
erickzhao
requested changes
Apr 2, 2026
Member
erickzhao
left a comment
There was a problem hiding this comment.
One more thing: Can we make this opt-in via the plugin config instead of the default behaviour?
I would also maybe target next instead of main because I'm currently trying to get the next major version of Forge to a more stable beta and releases go out faster. I think this would be a great addition!
Add `hotRestart` option to VitePluginConfig (default: false). The main process restart is now only enabled when explicitly configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c3d7b26 to
190c34c
Compare
# Conflicts: # .eslintignore # .github/workflows/ci.yml # .github/workflows/gh-pages.yml # .github/workflows/release.yml # .gitignore # lerna.json # package.json # packages/api/cli/package.json # packages/api/core/package.json # packages/api/core/spec/slow/make.slow.spec.ts # packages/api/core/spec/slow/package.slow.spec.ts # packages/external/create-electron-app/package.json # packages/external/create-electron-app/spec/fixture/custom_init/index.cjs # packages/maker/appx/package.json # packages/maker/base/package.json # packages/maker/deb/package.json # packages/maker/dmg/package.json # packages/maker/flatpak/package.json # packages/maker/msix/package.json # packages/maker/pkg/package.json # packages/maker/rpm/package.json # packages/maker/snap/package.json # packages/maker/squirrel/package.json # packages/maker/wix/package.json # packages/maker/zip/package.json # packages/plugin/auto-unpack-natives/package.json # packages/plugin/base/package.json # packages/plugin/fuses/package.json # packages/plugin/fuses/spec/FusesPlugin.slow.verdaccio.spec.ts # packages/plugin/local-electron/package.json # packages/plugin/vite/package.json # packages/plugin/webpack/package.json # packages/publisher/base-static/package.json # packages/publisher/base/package.json # packages/publisher/bitbucket/package.json # packages/publisher/electron-release-server/package.json # packages/publisher/gcs/package.json # packages/publisher/github/package.json # packages/publisher/nucleus/package.json # packages/publisher/s3/package.json # packages/publisher/snapcraft/package.json # packages/template/base/package.json # packages/template/base/tmpl/package.json # packages/template/vite-typescript/package.json # packages/template/vite-typescript/spec/ViteTypeScriptTemplate.slow.verdaccio.spec.ts # packages/template/vite/package.json # packages/template/webpack-typescript/package.json # packages/template/webpack-typescript/spec/WebpackTypeScript.slow.verdaccio.spec.ts # packages/template/webpack/package.json # packages/utils/core-utils/package.json # packages/utils/core-utils/src/index.ts # packages/utils/test-utils/package.json # packages/utils/tracer/package.json # packages/utils/types/package.json # packages/utils/web-multi-logger/package.json # tools/verdaccio/spawn-verdaccio.ts # tools/version.sh # vitest.workspace.mts # yarn.lock
Tom0Kim
reviewed
Apr 7, 2026
| * @param callback - A callback function that returns the value of the new `package.json` to be applied | ||
| * @returns The original `package.json` prior to mutation | ||
| */ | ||
| export async function updatePackageJSON( |
Member
|
Hey @bglgwyng, sorry for the disruption. It looks like changing the base branch messed up the PR state and added a bunch of unrelated changes into the diff. Would it be possible to re-apply the commits from your original PR onto a fresh copy of |
4 tasks
Author
|
Replaced by #4210 with a clean branch rebased on |
Member
|
Thank you! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add restartApp()/onAppRestart() to @electron-forge/core-utils as an explicit API for triggering Electron app restarts. The Vite plugin calls restartApp() in its closeBundle hook when the main process bundle is rebuilt. The start API registers the actual restart logic via onAppRestart(). The existing
rsstdin handler also goes through restartApp() now, so there's a single restart path.Summarize your changes:
Background
Main process hot restart for the Vite plugin has been requested and attempted multiple times:
process.stdin.emit('data', 'rs')to trigger restarts from the plugin, which reviewers flagged as a hack that should be replaced by an API exported from@electron-forge/core.process.stdincoupling issue.EventEmitter-based approach to decouple restart signaling fromprocess.stdin, but the PR was closed before merging.pluginHotRestart('restart')into@electron-forge/plugin-vite, but the restart branch was left commented out with// TODO: blocked in #3380because no cross-package restart API existed yet.What this PR does
Implements the approach suggested in #3380 and unblocks the commented-out code in #3583:
restartApp()andonAppRestart()to@electron-forge/core-utils, backed by a module-scopedEventEmitter. Plugins callrestartApp()to signal a restart; thestartAPI registers the actual kill→respawn logic viaonAppRestart().process.stdin.emit('data', 'rs')inpluginHotRestartwithrestartApp().rsstdin handler also callsrestartApp()instead of duplicating the restart logic, so both paths converge.