Skip to Content
0
Oct 30, 2020 at 07:31 AM

How to import a non-SAPUI5-library into SAPUI5-App

298 Views

Hi All,

I am trying to import external non-sap libraries into a SAP UI-5 Application, I have followed the above instructions and I was able to import moment library. I want to import keytar and nedb packages into the SAP UI-5 Application, but I am unable to import. Attached are the links for the packages and the sample code I am trying to import. Keytar:- https://www.npmjs.com/package/keytar
Nedb:- https://www.npmjs.com/package/nedb
jQuery.myUniqueNamespace = {
registerExternalLib: function (oShim) {
if (sap.ui.loader && sap.ui.loader.config) {
// official API since 1.56
sap.ui.loader.config({
shim: oShim
});
} else {
// internal API before 1.56
jQuery.sap.registerModuleShims(oShim);
}
}
};
jQuery.myUniqueNamespace.registerExternalLib({
"nxpcm/sample/ExtLibWithinFLP/libs/keytar": {
"amd": true,
"export": "keytar"
}
});
It is giving me ' require is not defined' error. Even I tried to import the require library as well following the above instructions, still I am unable to import keytar and nedb packages. Please help on this.