Repository navigation
Closed
Labels
area:frontendFrontend UI or interaction workarea:infraHost infrastructure and cache/provider operationsgrade:g2Standard change requiring testsphase:implementationImplementation in progressplan:singleSingle executable issue with one acceptance boundary
Description
背景
远程 Vite 开发服务经 FRPC + Nginx 访问时,HTML TTFB 约 0.2s,但无缓存首次加载会产生约 1421 个开发态模块请求,约 180s 才首次渲染;本机约 7s。根因是 bundleless ESM 模块图在高 RTT 链路上的分层请求瀑布,而非单纯 Nginx、FRPC 或传输字节问题。
Vite 8.0.16 已提供 highly experimental 的 experimental.bundledDev / --experimentalBundle,其上游 Full Bundle Mode 使用 Rolldown 增量模块图减少浏览器传输节点。
决策
采用远程专用 profile:优先复用 Vite Full Bundle Mode;默认本机开发保持现有 bundleless 模式。若 Full Bundle Mode 无法满足插件兼容、HMR 或稳定性停止条件,则保留明确的稳定回退入口,不给上游实验模式持续堆补丁。
范围
- 新增可显式运行的 remote dev profile。
- remote profile 启用 Vite Full Bundle Mode。
- 默认
pnpm --dir web/app dev行为不变。 - 为配置选择和关键兼容边界增加自动化合同。
- 验证 Native Runtime 插件、动态图标、dynamic import、Web Worker、React Refresh/HMR。
- 记录请求数、冷启动和 HMR 基线及停止条件。
非目标
- 不迁移 Rspack/Rsbuild。
- 不修改 Nginx 或 FRPC 生产配置。
- 不引入 Service Worker 开发缓存。
- 不以全局重写 barrel imports 代替本次传输层方案。
- 不改变生产构建输出。
Acceptance Ledger
- AC-001:默认本机 dev profile 保持 bundleless;remote dev profile 明确启用
experimental.bundledDev。证据:配置合同测试。 - AC-002:remote profile 可通过稳定 package script 启动,不要求开发者手工拼接实验 flag。证据:package contract 与启动 smoke。
- AC-003:remote profile 下关键模块请求数相对当前约 1421 个下降至少 90%,远程首次可交互 P95 不超过本机 P95 的约 2 倍。证据:无缓存 Playwright 网络与时间样本。
- AC-004:dynamic import、Web Worker、React Refresh/HMR 及现有 Native Runtime 模块插件没有阻断性回归。证据:定向自动化与浏览器 smoke。
- AC-005:若 Full Bundle Mode 出现插件不兼容、频繁 full reload、状态丢失,或 HMR P95 相对当前本地模式退化超过 20%,实现停止扩张并使用稳定回退入口。证据:验收记录。
验证边界
先做配置合同红灯,再实现最小 remote profile;随后执行定向测试、TypeScript/Vite 配置检查和两种 profile 启动 smoke。浏览器运行态证据使用项目 Playwright/page-debug。完整前端门禁交给 CI/专门质量工作区。
上游证据
- Vite Full Bundle Mode PR: feat: highly experimental full bundle mode vitejs/vite#21235
- Vite source-module request fan-out issue: Consider treeshaking module for serving files in dev mode vitejs/vite#8237
Metadata
Metadata
Assignees
Labels
area:frontendFrontend UI or interaction workarea:infraHost infrastructure and cache/provider operationsgrade:g2Standard change requiring testsphase:implementationImplementation in progressplan:singleSingle executable issue with one acceptance boundary
Activity
JAVA-LW commentedon Aug 29, 2026
实现与运行态证据(2026-08-30)
已完成远程 profile 的首轮实现与停止条件验证。
Full Bundle Mode 试验
vite@8.0.16 --experimentalBundle可启动,入口收敛为index.js + 4 preload chunks。/@vite/lazy请求,其中 394 个来自 Ant Design icons。Failed to fetch dynamically imported module: /@vite/lazy?...。稳定 fallback
dev保持vite,默认本机开发与 HMR 不变。dev:remote使用remote-debugproduction bundle + Vite preview,并生成 source map。dev:remote:experimental保留上游 Full Bundle Mode,供 Vite 升级后复验。Issue 暂留
phase:implementation,不以部分达标冒充完成。下一步需要用户体验稳定 fallback 后决定:接受“首次约 25s、后续缓存访问快”的边界,或另开 Nginx 云端 asset cache / 首屏模块图瘦身范围。JAVA-LW commentedon Sep 4, 2026
远程 profile 实现提交:d83a95761。按项目负责人确认,现关闭归档。