SAP/ui5-tooling

Minification failed with error

pg-ey opened this issue · 9 comments

Expected Behavior

Build successful with minification

Current Behavior

Error Message:
Minification failed with error: 'return' outside of function in file get-own-property-symbols.js (line 11, col 1, pos 255)

Steps to Reproduce the Issue

1.- name: ui5-task-minifier
afterTask: minify
configuration:
html: true
css: true
json: true

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 3.6.0
  • Node.js Version: 18.14.2
  • npm Version: 9.5.2
  • OS/Platform: Windows 10
  • Browser (if relevant): Chrome

Log Output / Stack Trace

Error: Minification failed with error: 'return' outside of function in file get-own-property-symbols.js (line 11, col 1, pos 255)
at AsyncFunction.execMinification (file:///home/user/projects/bre-v3/app/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/processors/minifierWorker.js:63:9)

Hi @pg-ey,
thanks for opening this issue here. From the input you provide above I expect a return statement in get-own-property-symbols.js which is not correctly placed. This file might be a custom js file located in your application and not provided by an UI5 library.
Could you please check this file?
If the issue still appears after you have fixed the return statement. Feel free to share the project with us, so we can have a deeper look.

Hi @flovogt , thanks for your response.
I don't have any custom js file with the name get-own-property-symbols.js.
However, when I build my app excluding minify, it works fine.

I have a doubt that there is a reference to getOwnPropertySymbols in one of the @ui5/cli dependencies which is causing the issue at the time of minifying.

Could you share your ui5.yaml and package.json or even better the whole application?

Do you have included https://github.com/es-shims/get-own-property-symbols into your project?

Do you have included https://github.com/es-shims/get-own-property-symbols into your project?

No, I haven't included this.

Could you share your ui5.yaml and package.json or even better the whole application?

Adding package.json and ui5.yaml here
package (1).json
ui5.zip

  1. Remove the ui5 section in the package.json - not needed any longer with UI5 Tooling v3
  2. I wonder if you need @sap/ui5-builder-webide-extension at all. Could please remove this dependency and also the tasks used in the ui5.yaml and see if the build works as expected

Also, could you please share the full build log? Ideally after adding the --verbose parameter.

  1. Remove the ui5 section in the package.json - not needed any longer with UI5 Tooling v3
  2. I wonder if you need @sap/ui5-builder-webide-extension at all. Could please remove this dependency and also the tasks used in the ui5.yaml and see if the build works as expected

Removing the 'ui5' section in the package.json has worked.
I will keep the @sap/ui5-builder-webide-extension till I figure out an alternative for my custom tasks.

Thanks @flovogt for the help.