fix: 修复 WebUI 白屏与 arm64/proot 下 Worker SIGSEGV (#1984)
* fix(webui): 合并 react/react-dom/scheduler 到 react-vendor chunk codemirror-core chunk 从 react-dom chunk 导入 forwardRef(r), 但 react-dom 被 manualChunks 单独拆块后未导出该绑定, forwardRef 为 undefined 导致 React 初始化崩溃、整页白屏。 将 react/react-dom/scheduler 合并为 react-vendor 块, 消除 React 19 下 chunk 间 forwardRef 跨块断裂。 * fix: Worker 改走 child_process.fork 并传 --no-sandbox(arm64/proot 下避免 UtilityProcess SIGSEGV) - process-api.ts: ProcessOptions 增加 execArgv 选项;isElectron 增加 NAPCAT_FORCE_NODE_PROCESS 环境变量判断,可强制走 Node 进程管理器 - napcat.ts: Node 进程路径下为 Worker 注入 execArgv: ['--no-sandbox'],规避 arm64/proot 环境 Electron UtilityProcess 崩溃(退出码 11) - 注:未包含原 commit 中 scripts/install.sh 的 Termux 特定补丁(该文件为 fork 私有,上游不存在)
This commit is contained in:
1 parent
0fcd0e80e0
commit
fe7a1f053a
3 files changed
+8
-3
No files matched your search
@@ -44,8 +44,11 @@ export default defineConfig(({ mode }) => {
|
||||
// if (id.includes('@heroui/')) {
|
||||
// return 'heroui';
|
||||
// }
|
||||
if (id.includes('react-dom')) {
|
||||
return 'react-dom';
|
||||
// React 19: react / react-dom / scheduler 必须合并到同一 vendor chunk,
|
||||
// 否则 react 的 forwardRef 等 API 会被错导向 react-dom 块而变成 undefined,
|
||||
// 导致 codemirror-core 等 chunk 初始化即崩溃(Cannot read properties of undefined (reading 'forwardRef'))。
|
||||
if (/[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/.test(id)) {
|
||||
return 'react-vendor';
|
||||
}
|
||||
if (id.includes('react-router-dom')) {
|
||||
return 'react-router-dom';
|
||||
|
||||
Reference in new issue
Block a user