SAP/ui5-tooling

Removal of createDebugFiles task is not compatible with SAP deliveries (no source code delivery)

GuillaumedesPommareSAP opened this issue · 4 comments

Hello,
I am in the process of migrating a shared UI5 library from ui5-cli 2.4 to 3.1.
I can share the repository privately.

We are not in a context of opensource. We are minifying the resources we produce, we do not share the source code, we do not provide debug files and map files to make the production code as light as possible and reduce download to the strict minimum.

We noticed that createDebugFiles and uglify tasks are removed in favor of minify. But, in that process, we lost the option not to create and deliver debug files.

Expected Behavior

Do not deliver any dbg or map file after a standard build process

Current Behavior

Files are created. Task cannot be configured not to do so, as it was possible before any 3.x version

Steps to Reproduce the Issue

Build any 2.x project having task createDebugFiles excluded but having task uglify included, run any 3.x project having task minify included

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 1.96.14/1.108.13
  • Node.js Version: 18.16.0
  • npm Version: 9.5.1
  • OS/Platform: Windows 11
  • Browser (if relevant): Chrome
  • Other information regarding your environment (optional): internal SAP project

Workaround

We developped a custom task to clean the output and remove all dbg and map files. This cleanup has to be called twice, before the minification step and after the library preload (to remove the map file associated to library preload)
I think this is a project overhead in term of cost and maintenance to comply with product standards. We should solve the issue once for all. Having debug files have sense for open source libraries, but this shall be disabled when working with non opensource products.

This cleanup has to be called twice, before the minification step and after the library preload

Could you please elaborate why the first cleanup is necessary? I would expect it to be enough to remove all unwanted after the library preload generation. I think I'm missing something. Thanks!

Could you please elaborate why the first cleanup is necessary? I would expect it to be enough to remove all unwanted after the library preload generation. I think I'm missing something. Thanks!

Maybe this is a question of fine tuning.
If I clean after minify:
image
If I clean after generateLibraryPreload:
image

The second one must be correct, with a single custom cleanup task, but I should double check if no resources are bundled somewhere.

Thank you. That seems to match with my expectations.

Yes, please double check the bundles. For the regular library-preload bundle generation we generally exclude all debug sources upfront: https://github.com/SAP/ui5-builder/blob/06fc4ba942d6d477c2762385f3ca3b8e1b568bd5/lib/tasks/bundlers/generateLibraryPreload.js#L253. So none should slip into the bundles there.

The only exception here is sap.ui.core which gets has a few -dbg variants (sap-ui-core-dbg.js for example) which are required for the debug mode (which you obviously don't need). We don't tag those particular bundles as IsDebugVariant yet. So that might be a fix we can provide for you if those files are problematic in your scenario too.

This issue has been automatically marked as stale because it has been open for 60 days with no activity. It will be closed in 10 days if no further activity occurs.