-
Notifications
You must be signed in to change notification settings - Fork 75
Description
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
- Create a UI5 library
- Add a script "MyWorker.js" somewhere in the package tree
- Add text
console.log("hello worker!")as file contents - Run ui5 build
- Note build failure on the MyWorker.js file.
Context
- UI5 Module Version (output of
ui5 --versionwhen 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
{...}