cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
5.49k stars 1.58k forks source link

[3.8.x] There is a need to support the output of js sourceMap files when building projects for native platforms #17196

Open zhefengzhang opened 1 week ago

zhefengzhang commented 1 week ago

Use Case

The current version of Cocos Creator records sourceMap data into the project scripts during the build process, which creates difficulties when submitting sourceMap files to crash tracking platforms. Therefore, there is a need to consider supporting the export of separate sourceMap files when building for native platforms.

当前版本的 CocosCreator 在构建时会将 souceMap 数据记录到项目脚本中,这让需要提交 souceMap 文件到崩溃跟踪平台时遇到困难。所以需要考虑支持在构建原生平台时支持输出独立的 sourceMap 文件。

80d96ca0d4c770ac0173f597608d96b3

Problem Description

-

Proposed Solution

No response

How it works

No response

Alternatives Considered

-

Additional Information

No response

dumganhar commented 2 days ago

当前编译引擎脚本和项目脚本,已经支持选择 sourceMap 的类型为“关闭”、“独立文件”、“内嵌到脚本” 三个选项。只是构建面板中的 UI 只有一个 CheckBox。如果打钩✅,原生上被写死了“内嵌到脚本”,非原生上写死了“独立文件”。

之前原生上搞成内嵌,是因为远程调试无法使用分离 sourceMap 。但是如果是发布游戏正式版,是希望sourcemap 为分离的,否则游戏源码会被泄露,而且增加了包体。

因此,应该把 Checkbox 改为 下拉框,分为 “关闭”、“独立文件”、“内嵌到脚本” 三个选项。

另外,是否叫“独立文件”,可能还得斟酌一下。“独立文件” or “独立的文件” or “分开的文件” or “分离的文件”。

关于迁移

如果用户之前启用 sourceMap,即打钩✅,那么原生平台,迁移到“内嵌到脚本”,非原生平台迁移到“独立文件”。