#19249·cocos-engine

H5 构建转译与第三方代码的兼容性问题 @flatten-js/core

Author: fsd-chinaCreated Sep 28, 2026Updated Sep 28, 2026
LabelsBugNeeds Triage

Cocos Creator version

3.8.8

System information

H5

Issue description

@flatten-js/core 的 Polygon.area() 使用 [...this.faces],H5 转译后变成 [].concat(this.faces),导致 PlanarSet 被当成单个元素传入 reduce。模拟器保留原生迭代语义,因此不报错。

Relevant error log output

No response

Steps to reproduce

@flatten-js/core 对 PlanarSet 使用了 [...this.faces]。 H5 转译把它错误降成 [].concat(this.faces),没有按可迭代对象展开。 PlanarSet 不是数组,所以后续拿到的是容器本身,才出现 signedArea is not a function。 模拟器使用原生迭代语义,因此没有触发。

Minimal reproduction project

No response