Search code examples
sapui5

Development using typescript and production debugging with Component-preload.js


I am working on the SAPUI5 application with normal ES5 code and using grunt-openui5 to create the Component-preload.js file to deploy to CRM system. Now I am planning to use ES6 style coding but we need to support an old browser. Therefore, I need to transpile it down to ES5 and then create the Component-preload.js file. Now my concern with this approach is when I debug the production issue, everyone gets it right, I want to debug my ES6 file, not ES5 file.

Any help or guidance is very appreciated.


Solution

  • One way to have a transpiled, debuggable preload file and separate ES6 based source files is probably to use the sap-ui-debug=true URL parameter option. Instead of the normal files, it will try to load -dbg.js versions of everything. This for instance is what the SAP WebIDE generates:

    enter image description here

    If you can set up your build set so that the original, untranspiled files are copied as -dbg versions, and your preload picks up the transpiled ones you might be able to make it work.

    Here's the section of the SDK documentation that'll give you some more background information: https://openui5.hana.ondemand.com/#/topic/c9b0f8cca852443f9b8d3bf8ba5626ab