question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sap-ui-core.js incorrectly alters URL (in new build)

See original GitHub issue

Expected Behavior

Where ever I place sap-ui-core.js, this becomes the default resource root for everything. e.g. if the path to sap-ui-core.js is: /resources/v1.2.3/sap-ui-core.js then the path to sap.ui.core preload is: /resources/v1.2.3/sap/ui/core/library-preload.js

Current Behavior

Because “resources” is in the path, it looks as if it is assumed to be the default root. e.g. When the path to sap-ui-core.js is: /resources/v1.2.3/sap-ui-core.js the path to sap.ui.core preload is presumed to be: /resources/sap/ui/core/library-preload.js So the runtime fails to load.

Steps to reproduce the issue

  1. Clone openui5-sample-app
  2. npm install
  3. ui5 build -a
  4. Start a (http server) pointing to ./dist and verify app starts as expected
  5. Copy contents of resources into a sub-folder of resources. E.g. /resources/v1.2.3
  6. Correct path in index.html to load sap-ui-core from /resources/v1.2.3/sap-ui-core.js

Result:

With the browsers dev tools open, you can see sap-ui-core.js loads fine (as expected), but then the client attempts to load all the preloads from /resources/* (and not /resources/v1.2.3/*)

Note: For the purposes of this ticket, everything was tested with 1.63. However, right now (until we’ve finished our migration to ui5-tooling) we primarily carry out tests on version 1.58.4 where we can compare the older “bower” version with the newer ui5-tooling variant. As such, we can see this issue only occurs with the ui5-tooling variant and not with the older bower version.

Context

  • UI5 Module Version 1.2.1
  • Node.js Version: v10.15.1
  • npm Version: n/a
  • OS/Platform: Windows 10
  • OpenUI5 1.63

Affected components (if known)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
codeworriorcommented, Apr 15, 2019

I had taken another look at this, a few days ago, but didn’t post un update here.

I meanwhile think this is related to https://github.com/SAP/openui5/commit/ccbce4e88c2aae3021b70874f7e7ce373e166394. With this change, script tags with id=sap-ui-bootstrap are not only preferred, but their URL is no longer checked for well known names, only for a resources/ segment. Preferring the scripts with the id makes sense, but even then we should check the path for well known names first and only if that fails, fall back to the resources/ segment.

0reactions
ghostcommented, Apr 17, 2019

I did a compare between the bower built version and the ui5-tooling build version of some key files:

  • sap-ui-core.js
  • sap-ui-boot.js
  • ui5loader.js
  • ui5loader-autoconfig.js

I was amazed to see that although these were both built with two entirely different tools, the output is impressively similar. Meaning I’m even more confused as to how I don’t have this issue when I use the bower variant of 1.58.4, but I do, when I use the ui5-tooling variant of 1.58.4.

The only difference I found was in sap-ui-core.js where the Mozilla polyfill for Object.assign is no longer at the top (almost) of the file. Hardly a smoking gun.

If there is anything more I can do on my side, please let me know. But this issue no longer blocks me thanks to the great tip from @codeworrior

Read more comments on GitHub >

github_iconTop Results From Across the Web

src="/resources/sap-ui-core.js" not loading in web IDE?
I am doing this mainly to understand how to configure the neo-app file according to folder structure changes, all documents on the net...
Read more >
Why is my OpenUI5 app not loading properly sometimes?
I see that the app bootstraps OpenUI5 from the CDN without specifying a concrete framework version aka. "default version".
Read more >
Posts • SAPUI5 • Neptune Software Community
Hello Team,I am curious how the Neptune is fetching sap-ui-core.js file in bootstrapping, I see in the template you are using ...
Read more >
NEW: Nightly Builds of OpenUI5 Available Online
As a new service to users of OpenUI5, we now offer the latest nightly build result at https://openui5nightly.hana.ondemand.com.
Read more >
Documentation - Demo Kit - SAPUI5 SDK
ClientTreeBinding#getCount[FIX] sap/ui/core/format/DateFormat: wide and ... the page[FIX] The Table building block no longer loads data on initialization if ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found