Skip to content

fix: stabilize Vite 8/Rolldown beta, merge pending fixes, support Electron 42/43 - #1

Merged
yi-ge merged 2 commits into
masterfrom
feat/vite8-stabilize-electron43
Jun 27, 2026
Merged

fix: stabilize Vite 8/Rolldown beta, merge pending fixes, support Electron 42/43#1
yi-ge merged 2 commits into
masterfrom
feat/vite8-stabilize-electron43

Conversation

@yi-ge

@yi-ge yi-ge commented Jun 27, 2026

Copy link
Copy Markdown
Member

概述

v6.0.0-beta.1(Vite 8 / Rolldown 迁移已完成但停滞)稳定为可发布状态,修复全部 Vite 8 / Rolldown 回归新增 Electron 42/43 支持,并合并一批长期未处理的上游有价值 PR。本 fork 发布为 @desirecore/electron-vite(CLI 命令仍为 electron-vite)。

所有改动均在 macOS / Node 25 / Vite 8.1 / Electron 41.9 · 42.5 · 43.0-beta 上做了真实端到端验证(构建 + 启动真实 Electron 应用自检),而非仅单元/逻辑验证。

Issue/PR 编号引用上游 alex8088/electron-vite 追踪器。

修复的 Vite 8 / Rolldown 回归

bytecode(核心修复 + 增强)

Electron 运行时与 CLI

验证证据(均真实复现/运行)

验证
alex8088#906 真实构建:main 产物非空、shim 在顶部、合法 ESM
alex8088#916 构建输出无 oxc/esbuild 告警
alex8088#902 reactCompilerPreset() + @rolldown/plugin-babel 原文配置构建通过
alex8088#915 照搬 issue 配置(root 外 HTML)构建通过、无 ../
alex8088#860/alex8088#862 嵌套 ?modulePath 独立成块、运行时路径正确、无 default 报错
alex8088#911/alex8088#912 Electron 41 + 42 + 43 编译且运行时执行(add=5)、无 cachedDataRejected
alex8088#910 5 次构建 .jsc 哈希完全一致
alex8088#905 删除二进制后构建自动下载恢复
alex8088#900 dev 起 3 个 Electron,SIGINT 父进程后全部退出、0 残留
alex8088#578/alex8088#867/alex8088#885/alex8088#710/alex8088#480 各自真实构建/运行验证通过
全栈 真实 Electron 应用启动:bytecode(main+preload) + swc + modulePath + contextBridge IPC 全绿

未覆盖(已在 CHANGELOG/文档标注)

Windows / Linux 未在本机验证;Linux 下 build.bytecodexvfb-run

  • 已发布 @desirecore/electron-vite@6.0.0-beta.2@6.0.0-beta.3(含 Electron 43 target),latestbeta 均指向 6.0.0-beta.3
  • bin 命令保留 electron-vite 以兼容现有脚本。

🤖 Generated with Claude Code

yi-ge and others added 2 commits June 27, 2026 16:40
Fork release as @desirecore/electron-vite (v6.0.0-beta.2). Fixes a batch
of Vite 8 / Rolldown regressions and Electron 42 support, and merges
several long-pending upstream fixes.

- fix(esmShim): AST-based CJS shim injection at offset 0, no longer
  corrupts large Vite 8/Rolldown ESM bundles (alex8088#906)
- fix(swc): also set `oxc: false` to disable Vite 8 default transform (alex8088#916)
- fix(config): do not throw on non-plain objects when isolating config (alex8088#902)
- fix(renderer): re-root when HTML entry is outside root, avoid illegal
  `../` emit paths under Rolldown (alex8088#915)
- fix(bytecode): compile via vm.compileFunction in the consuming process
  type, fixing cachedDataRejected on Electron 42 / V8 14.8 (alex8088#911, alex8088#912)
- fix(bytecode): remove non-deterministic compile race (alex8088#910)
- fix(bytecode): correct renderer preset plugin name; locate the compiler
  script relative to this module so it survives package renames
- fix(modulePath): inject modulePathPlugin into the sub-build for nested
  `?modulePath` and re-exports (alex8088#860, alex8088#862)
- fix(dev): forward signals to the Electron child and escalate to SIGKILL
  on restart, fixing zombie processes (alex8088#899, alex8088#734, alex8088#353)
- feat: support Electron 42 targets and lazy electron install (alex8088#904)
- feat(bytecode): allow RegExp for chunkAlias; protect string concat (alex8088#885)
- feat(cli): add --noElectronStart (alex8088#578) and --electronPackage (alex8088#867)
- feat: export workerPlugin (alex8088#480)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add Electron 43 to the node/chrome build-target tables (Node 24.17 /
Chromium 150). Verified end-to-end on Electron 43 (V8 15.0), including
build.bytecode compile + runtime execution. Unknown newer versions
continue to fall back to the newest known target.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 27, 2026 10:10
@yi-ge
yi-ge merged commit 02cb574 into master Jun 27, 2026
@yi-ge
yi-ge deleted the feat/vite8-stabilize-electron43 branch June 27, 2026 10:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Stabilizes the v6 Vite 8 / Rolldown beta line by hardening several build/runtime plugins (esm shim, bytecode, modulePath, swc), improving Electron dev-process lifecycle handling, and expanding Electron version support (42/43) while publishing this fork as @desirecore/electron-vite.

Changes:

  • Fixes multiple Vite 8 / Rolldown regressions (AST-driven esm shim injection, renderer root re-rooting for out-of-root HTML inputs, nested ?modulePath support, SWC disabling Oxc).
  • Reworks bytecode compilation/loader to be Electron 42+ (V8 14.8+) compatible and deterministic; adds chunkAlias RegExp support and string-concat protection.
  • Improves CLI/dev ergonomics (signal forwarding, restart kill escalation, --noElectronStart, --electronPackage) and updates fork packaging/docs.

Reviewed changes

Copilot reviewed 14 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils.ts Adjusts deepClone behavior for non-plain objects to avoid throwing during config isolation.
src/server.ts Adds --noElectronStart support and introduces SIGKILL fallback on hot-reload restarts.
src/plugins/worker.ts Exposes workerPlugin as a named export while preserving default export.
src/plugins/swc.ts Disables both esbuild and Vite 8’s default oxc transformer when using SWC.
src/plugins/modulePath.ts Re-injects modulePathPlugin into sub-builds to support nested ?modulePath.
src/plugins/esmShim.ts Switches esm shim injection to AST-based detection and prepends at offset 0.
src/plugins/electron.ts Re-roots renderer build when HTML inputs live outside root to satisfy Rolldown emit rules.
src/plugins/bytecode.ts Refactors bytecode compilation/loader for Electron 42+ compatibility and determinism; extends options.
src/index.ts Re-exports worker plugin from package entry.
src/electron.ts Adds Electron 42/43 targets, lazy binary install for Electron 42+, signal forwarding, and custom pkg support.
src/cli.ts Adds --noElectronStart and --electronPackage, wiring them into env/config.
README.md Updates install instructions for fork package name while keeping CLI name.
package.json Renames package to @desirecore/electron-vite, bumps version, updates repo metadata/publishConfig.
CHANGELOG.md Documents beta.2/beta.3 changes and Linux/Xvfb note for bytecode.
bin/electron-bytecode.cjs Reworks bytecode compiler to run in appropriate Electron process type (main vs renderer).
bin/electron-bytecode-preload.cjs Adds renderer preload compiler for preload-chunk bytecode generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/bytecode.ts
Comment on lines 213 to +217
const isBytecodeChunk = (chunkName: string): boolean => {
return transformAllChunks || _chunkAlias.some(alias => alias === chunkName)
return (
transformAllChunks ||
_chunkAlias.some(alias => (alias instanceof RegExp ? alias.test(chunkName) : alias === chunkName))
)
Comment thread src/plugins/esmShim.ts
Comment on lines +47 to 54
function hasCJSIdentifier(root: AstNode): boolean {
const queue: AstNode[] = [root]
while (queue.length > 0) {
const node = queue.pop()
if (!node || typeof node !== 'object' || !node.type) continue

if (node.type === 'Identifier' && typeof node.name === 'string' && CJSIdentifiers.has(node.name)) return true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants