EAS 更新的打包包差异比较
在可用时,使你的项目能够接受打包包差异。
For the complete documentation index, see llms.txt. Use this file to discover all available pages.
启用 bundle 差异比较,让 EAS Update 在可能的情况下提供 bundle 补丁。当你发布新的更新时,EAS Update 可以生成一个较小的文件,其中仅包含设备上正在运行的 bundle 与新 bundle 之间的差异。这通常可以显著减少更新下载大小。
🌐 Enable bundle diffing to let EAS Update deliver a bundle patch when possible. When you publish a new update, EAS Update can generate a smaller file containing only the differences between the bundle currently running on the device and the new bundle. This often reduces update download size significantly.
启用包差异比较
🌐 Enable bundle diffing
在你项目的应用配置中,将 updates.enableBsdiffPatchSupport 设置为 true:
🌐 In your project's app config, set updates.enableBsdiffPatchSupport to true:
{ "expo": { "updates": { "enableBsdiffPatchSupport": true } } }
验证包差异是否正在提供
🌐 Verify bundle diffs are being served
Expo 网站
🌐 Expo website
你可以在 更新详情 页面确认打包包差异是否已提供。打开你发布的更新组,然后选择你想要检查的平台。
🌐 You can confirm that bundle diffs are being served from the Update Details page. Open the Update Group you published, then select the platform you want to inspect.
更新 API
🌐 Updates API
你可以通过使用 Updates.readLogEntriesAsync() 检查更新日志来确认是否提供了 bundle 差异。如果你的应用收到了补丁,你将看到一条条目,显示补丁已成功应用(例如,“补丁成功应用”)。
🌐 You can confirm that bundle diffs are being served by inspecting update logs with Updates.readLogEntriesAsync(). If your app received a patch, you will see an entry indicating it was successfully applied (for example, "patch successfully applied").
补丁生成与发布
🌐 Patch generation and serving
EAS 更新使用 bsdiff 算法 来生成包补丁。
🌐 EAS Update uses the bsdiff algorithm to generate bundle patches.
补丁仅在以下情况下提供:
🌐 A patch is served only when:
- 它比完整包显著更小。 如果不是,EAS Update 会改为提供完整包。
- 它可以高效地计算。 如果生成补丁耗费的资源过多,EAS 更新会改为提供完整的包。
当前限制
🌐 Current limitations
- 嵌入式包不符合条件。 嵌入式包从不被用作补丁的基础。设备必须已经运行已发布的更新才能接收补丁。
- 补丁并不能保证立即适用于每一对可能的更新。 当发布更新时,EAS 更新只会针对该通道上倒数第二个更新预生成补丁。如果设备在运行不同的已发布更新时请求新的更新,它最初将接收到完整的包。随后,会根据需求为该特定基础更新生成补丁,并提供给将来的类似请求。
- 补丁会在发布后不久生成。 从发布更新到补丁准备好可能需要几分钟。在此期间,设备可能会接收到完整的安装包。