cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member710548
Discoverer
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

FlorianVogt
Advisor
Advisor
0 Kudos

Hi vav4001,
thanks for posting this question. Did you already tried https://blogs.sap.com/2017/04/30/how-to-include-third-party-libraries-modules-in-sapui5/?
Its a very well described blog post.

former_member710548
Discoverer
0 Kudos

Hi Florian,


Thanks for responding to the question.I have tried using the same approach and I am able to import moment library, but I am unable to include the npm packages "keytar" and "nedb" by following the same approach.

FlorianVogt
Advisor
Advisor
0 Kudos

Hi vav4001,

could you share a sample application? So it's easier to debug the setup.

Are you using the UI5 tooling?

Thanks a lot!

Answers (0)