cancel
Showing results for 
Search instead for 
Did you mean: 

library-preload not found for custom SAPUI5 library

sergiu_popa
Participant
0 Kudos

Hello experts,

I'm currently trying to have a custom SAPUI5 library properly imported and used by an array of applications deployed in the Fiori Launchpad of an S/4HANA system.

Now, what I have done was to copy the library files into a corresponding "lib" folder and reference them in the manifest.json, as well as in the corresponding view controllers.

Next, I deployed the application that uses the library, registered it with the Fiori Launchpad and tried to run the app.

App runs fine, but if I check the console I have the following errors:

What puzzles me is that the runtime looks for the library-preload.js into the files of another SAPUI5 app (the library used is also deployed as an SAPUI5 app), as opposed to looking for it in the resourceRoots defined in manifest.json.

Is there a reason why this happens? I would expect for the runtime of the Fiori Launchpad to consider manifest.json and look for library-preload.js in ./lib/com/customlibrary/library-preload.js.

Thank you and have a good day!
SePo

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member312987
Active Participant
0 Kudos
maheshpalavalli
Active Contributor
0 Kudos

Hi sergiu.popa

I think that is intended for loading the components in the same folder (Sub components with same namespace), not exactly sure though, check the documentation on resourcesRoots if it makes any sense, I only understood bits and pieces there.

https://help.sap.com/doc/saphelp_uiaddon20/2.05/en-US/be/0cf40f61184b358b5faedaec98b2da/frameset.htm

Ideally it should work by default without the need for providing any resourceRoots..

Can you tell me what did you mean by "copy all the files to lib folder"? i hope the library is still deployed under UI5_UI5 SICF node..

Thanks,
Mahesh

sergiu_popa
Participant
0 Kudos

Hi Mahesh,

The library is still deployed in the system, but what I'm trying to achieve here is to not have a single point of failure.
By "copy all the files to the lib folder" I mean that files of the library I created are copied to a "lib" folder of the app where I want to use the library. The purpose would be that the app will load the library files from the "lib" folder as opposed to loading them from the deployed SAPUI5 library.

Cheers,
SePo

maheshpalavalli
Active Contributor
0 Kudos

Hi sergiu.popa,

So you mean that there is a library already available, but you don't want to load that library and instead load the local library that copied into your ui5 app from the original library right?

If yes, you don't need to reference your library there, just simply use it in your view or controller directly right?

Thanks,

Mahesh

sergiu_popa
Participant
0 Kudos

Hi Mahesh,

Thanks for you inputs. I hope I'm using your name correctly :-).
I'm already doing this. My problem is that in this case the app doesn't use the optimization provided by the library-preload. I'm actually building a library-preload.js file inside the ./lib folder and I would expect that the application will look and load this file from the corresponding folder and not from the deployed SAPUI5 library.

Have a good day!
Sergiu

maheshpalavalli
Active Contributor
0 Kudos

Hi sergiu.popa

Yes, that's correct 🙂

I believe library-preload will just have all those library files minimified in to single file, which is the only optimization I think of.

But the same will happen when you create the component-preload for your app, which will now include your ./lib folder files as well, so you can just remove the lib config from manifest.json and directly access the custom control inside your app right? or am I missing something here?

Thanks,
Mahesh

sergiu_popa
Participant
0 Kudos

Hi Mahesh,

You are right, the files could also be loaded from Component-preload.js. Nevertheless, one of the reasons for trying to use the library is the fact that I can use i18n texts from the library's messageBundle.

If I use Component-preload.js, then i18n texts will have to come from the component which ultimately creates a dependency between the component and the library.

Cheers,
Sergiu

maheshpalavalli
Active Contributor
0 Kudos

Ohh, I am sorry sergiu.popa, I also don't know.. It looks like it is working from the webide but not when it is deployed, not sure the reason about it..

Small question again, you have already added the dependencies when you moved the library into the component, now it doesn't matter right if the text is coming from component or library..

Thanks,

Mahesh

sergiu_popa
Participant
0 Kudos

Hi Mahesh,

Not really; it does matter because if I don't have the i18n texts in the library, then I always have to copy the texts to the i18n bundle of the component.

I moved the library into the component just to avoid having a single point of failure. Now, when I use the library, all I want to do is just copy the files into my component's lib folder and that's all. I don't want to care about copying the i18n texts to the component.

Cheers,
Sergiu