Hi,
I tried https://github.com/cevou/openui5-sample-app. It works fine with UI5 1.52. However, I ran into several issues in UI5 1.54 and 1.56. I was able to get it running by twisting the UI5 source code a little. But it is of course not a solution. Please suggest a solution for this issue.
I will explain the issues I encountered as follows. jquery.sap.global has changed in 1.54 to use sap.ui.define. Several imports in openui5-sample-app are no longer required.
sap.ui.define([
// new sap/base/* modules
"sap/base/util/now",
"sap/base/util/getObject", "sap/base/util/getter", "sap/base/Version",
"sap/base/util/extend", "sap/base/assert", "sap/base/log",
// new sap/ui/* modules
"sap/ui/Configuration", "sap/ui/dom/appendHead", "sap/ui/dom/computedStylePolyfill", "sap/ui/dom/activeElementFix", "sap/ui/dom/includeScript",
"sap/ui/dom/includeStylesheet", "sap/ui/initjQuerySupport", "sap/ui/initSupportHooks", "sap/ui/initjQueryBrowser",
"sap/ui/security/FrameOptions", "sap/ui/performance/Measurement", "sap/ui/performance/Interaction", "sap/ui/performance/ResourceTimings",
"sap/ui/bootstrap/StoredConfig", "sap/ui/SyncPoint", "sap/ui/XHRProxy",
// former sap-ui-core.js dependencies
"sap/ui/Device", "sap/ui/thirdparty/URI",
"sap/ui/thirdparty/jquery",
"sap/ui/thirdparty/jqueryui/jquery-ui-position",
"ui5loader-autoconfig"
], function(now, getObject, getter, Version, extend, assert, log,
Configuration, appendHead, computedStylePolyfill, activeElementFix, includeScript,
includeStylesheet, initjQuerySupport, initSupportHooks, initjQueryBrowser,
FrameOptions, Measurement, Interaction, ResourceTimings,
StoredConfig, SyncPoint, XHRProxy,
Device, URI,
jQuery/*, jqueryUiPosition, ui5loaderAutoconfig*/) {
.......
}
Based on the order of issues I ran into, the major changes that cause the problems are listed below:
- A new dependency ui5loaderAutoconfig. I added two import statements to solve this problem.
import "ui5loader";
import "ui5loader-autoconfig";
In addition, ui5loaderAutoconfig validates baseURL by checking the global scope window['sap-ui-config'].
window["sap-ui-config"] = {
theme: "sap_belize",
bindingSyntax: "complex",
compatVersion: "edge",
resourceRoots: {
'': 'resources/'
}
};
- In the main function of jquery.sap.global, the following throws cannot access jquery of undefinied (i..e fn is undefined). I debugged into this line, the problem is jQuery is evaluated to empty object "{}". I haven't got time to investigate why jQuery is not evalued to "sap/ui/thirdparty/jquery", since Device, URI, and other dependencies are evaluated successfully.
var oJQVersion = Version(jQuery.fn.jquery);
To temporarily remove this runtime error, I import "jquery.sap.global-dbg" instead. In the -dbg version, I commented out the jQuery parameter and instead usingjQuery that has been instantiated in global scope through script-loader. See the changes I made below.
sap.ui.define([
......
// former sap-ui-core.js dependencies
"sap/ui/Device", "sap/ui/thirdparty/URI",
"sap/ui/thirdparty/jquery",
"sap/ui/thirdparty/jqueryui/jquery-ui-position",
"ui5loader-autoconfig"
], function(now, getObject, getter, Version, extend, assert, log,
......
Device, URI/*,
jQuery, jqueryUiPosition, ui5loaderAutoconfig*/) {
.......
}
- Similarly, I referred to "sap/ui/initjQuerySupport-dbg" instead of "sap/ui/initjQuerySupport" in jquery-sap-global, and removed the jQuery passed to the main function in sap.ui.define for initjQuerySupport.
Please kindly help on these issues.