SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
465 stars 69 forks source link

Unexpected identifier 'assert' related with Node v22.7.0 #1003

Closed thecoldstone closed 3 weeks ago

thecoldstone commented 3 weeks ago

Expected Behavior

Project is running locally

Current Behavior

Fails with the following error when I run ui5 serve --port 3000 --config ui5-local.yaml --open index.html

> sct-master-data-ui@0.0.1 start:local
> ui5 serve --port 3000 --config ui5-local.yaml --open index.html

info graph:helpers:ui5Framework Using SAPUI5 version: 1.127.0

⚠️   Process Failed With Error

Error Message:
Unexpected identifier 'assert'

Stack Trace:
SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
    at callTranslator (node:internal/modules/esm/loader:436:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:30)

Steps to Reproduce the Issue

  1. Clone repo (internal URL removed by MB)
  2. Run it locally npm run start:local

Context

Log Output / Stack Trace

{...}
RandomByte commented 3 weeks ago

Thanks for reporting @thecoldstone

Looks like we missed a deprecation in V8: https://v8.dev/features/import-attributes

We'll prepare a fix. Until then, please downgrade to an older Node.js release.

RandomByte commented 3 weeks ago

Looks like I jumped the gun on this one.

I actually can't reproduce this issue using Node.js 22.7.0 and UI5 CLI v3.11.1 or the latest v4.0.5. I also couldn't find code that still makes use the import assert keyword. I think we removed affected code a while ago.

I disabled the configured custom middleware in your project one by one to test which one is causing the error. It looks like the "dwc" middleware is the culprit. Please contact the maintainers of that package directly as it is not in our responsibility.

Also please keep in mind that github.com is a public platform. Therefore you must not post any internal URLs. I have removed the URL from your post.