How to integrate External Librairies in SAPUI5/UI5/Fiori #802
christophelannoyadeo opened this issue · 1 comments
Hi @flovogt ,
thanks a lot for your help and links.
-
for shims, I have found that I have an issue. In BAS, i can only use spec 2.6 and I need to be in 3.0 to be able to use "@" in the name definition. If I want to use shims, in ui5.yaml, in " configurations" section the name as to be the same as package.json. But in dependancy, I am obliged to use @datadog/browser-rum so I think just right now
-
so I have tried to use your example but I still ecnounter a probleme when strating my application
In controler I have put this code
`sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/model/json/JSONModel",
"sap/ui/Device",
"sap/ui/demo/walkthrough/thirdparty/datadog-rum-v4"
], function (UIComponent, JSONModel, Device, _DD_RUM) {"use strict";
// Provides a shim for the datadog-rum library
sap.ui.loader.config({
paths: {
"sap/ui/demo/walkthrough/thirdparty/datadog-rum-v4": "https://www.datadoghq-browser-agent.com/datadog-rum-v4.js"
},
shim: {
"sap/ui/demo/walkthrough/thirdparty/datadog-rum-v4": {
amd: true,
exports: "_DD_RUM"
}
}
});
return UIComponent.extend("sap.ui.demo.walkthrough.Component", {
metadata: {
interfaces: ["sap.ui.core.IAsyncContentCreation"],
manifest: "json"
},
init: function () {
// call the init function of the parent
UIComponent.prototype.init.apply(this, arguments);
// set data model
var oData = {
recipient: {
name: "World"
}
};
var oModel = new JSONModel(oData);
this.setModel(oModel);
// set device model
var oDeviceModel = new JSONModel(Device);
oDeviceModel.setDefaultBindingMode("OneWay");
this.setModel(oDeviceModel, "device");
// create the views based on the url/hash
this.getRouter().initialize();
},
getContentDensityClass : function () {
if (!this._sContentDensityClass) {
if (!Device.support.touch) {
this._sContentDensityClass = "sapUiSizeCompact";
} else {
this._sContentDensityClass = "sapUiSizeCozy";
}
}
return this._sContentDensityClass;
}
});
});I launch npm run build and launch the application, but it generates a probleme when loading
'sap/ui/demo/walkthrough/thirdparty/datadog-rum-v4.js': failed to load 'sap/ui/demo/walkthrough/thirdparty/datadog-rum-v4.js' from ../thirdparty/datadog-rum-v4.js: script load error`
As It works for you application, I don't understand why I am stuck on mine..
Any clue?
best Regards
Originally posted by @christophelannoyadeo in #802 (comment)