-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent Build Artifacts Across Multiple Platforms #50
Comments
@KonghaYao 不同系统, 编译器, CPU 会导致浮点精度不一致, 从而让 woff 内部 brotli 压缩后二进制不一样, 这个无法在 lib 层级解决. wasm 是跨平台一致的, 所以没有这个问题. |
@Brooooooklyn 好的。估计我们以后的版本将会考虑一下 |
你构建 woff2 文件给 CDN 会在不同的平台去做?如果这是不可避免的,可能需要换一种方式来做缓存了 |
对的,Netlify 自动分配的机器会在不同的 Linux 环境运行,导致采用不同的 .node 文件进行 woff2 构建,最终就是产物 hash 不一致导致的 BUG。@yisibl |
你这个情况可能不能用 content hash 了,得根据字体压缩前的内容做 hash |
的确,我这边目前就是根据子集化的文本生成 hash 来做 Redis 缓存的 key。 要么你只能更换稳定的服务器,在固定的系统中构建 woff2 文件。 |
@Brooooooklyn @yisibl 感谢两位的帮助,harfbuzz 进行字符子集化的 ttf 结果文件的二进制是固定的,在 woff2 压缩之前进行 hash 获取,这样就可以稳定缓存了。 |
您好,woff-build 是一个非常强的项目,在 cn-font-split 中极大提升了 ttf 至 woff2 性能。但是在中文网字计划的 CDN 中,发现了构建产物发生变化,导致 CDN 缓存失效。最后,我们排查出是 @napi-rs/woff-build 在不同平台,构建产物会不一致,而我们最初使用的 wasm 版本的 @chinese-fonts/wawoff2 是一致的。但是我们对 napi 并不熟悉,所以需要您的帮助! @Brooooooklyn @yisibl
下面是 Windows 和 Linux 环境的对比测试:
Hello, woff-build is an excellent project that significantly improves the performance of converting ttf to woff2 in cn-font-split. However, we have noticed changes in the build artifacts in the CDN of the Chinese Web Fonts Project, which has caused CDN cache invalidation. After investigation, we found that the build artifacts of @napi-rs/woff-build are inconsistent across different platforms, whereas the wasm version of @chinese-fonts/wawoff2 that we initially used is consistent. However, we are not familiar with napi, so we need your help! @Brooooooklyn @yisibl
Below is a comparison test between Windows and Linux environments:
The text was updated successfully, but these errors were encountered: