UI5 CLI 4.0 specification is incompatible with web workers

未关闭
#1,276 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
领域
build-system, cli

调研方向

Start by reproducing the failure with a UI5 library containing MyWorker.js and ui5 build, using the reported specVersion 4.0.6 environment. Read the Builder documentation on JavaScript files requiring top-level scope and compare the error with the expected behavior. Done means a web worker script builds successfully under specification 4.0 without loading the UI5 framework in the worker.

由索引模型根据 Issue 内容生成。

描述

help provided

For UI5 projects utilizing web workers, the new restriction on "JavaScript Files Requiring Top Level Scope" in specification 4.0 renders the projects incompatible with the UI5 CLI build.

The problem is that a web worker script cannot be wrapped in a sap.ui.require or sap.ui.define function call since it is neither possible nor desirable to load the UI5 framework within a worker. The worker's driver scripts, by definition, run code in the global context, which the new specification prohibits.

Expected Behavior

Build completes successfully as in the previous specification versions.

Current Behavior

Builds fail with error error lbt:bundle:Builder Module {...redacted...}/SomeWorker.js requires top level scope and can only be embedded as a string (requires 'eval'), which is not supported with specVersion 4.0 and higher. For more information, see the UI5 Tooling documentation https://sap.github.io/ui5-tooling/stable/pages/Builder/#javascript-files-requiring-top-level-scope

Steps to Reproduce the Issue

  1. Create a UI5 library
  2. Add a script "MyWorker.js" somewhere in the package tree
  3. Add text console.log("hello worker!") as file contents
  4. Run ui5 build
  5. Note build failure on the MyWorker.js file.

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 4.0.6
  • Node.js Version: 20.11.0
  • npm Version: 10.2.4
  • OS/Platform: MacOS
  • Browser (if relevant): N/A
  • Other information regarding your environment (optional): nothing

Log Output / Stack Trace

{...}
主要语言
JavaScript
星标
510
派生
80
平均合并
2 天 22 小时
30 天内合并 PR
12

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

UI5/cli 的其他 Issue

查看 UI5/cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。