on 05-20-2015 10:26 AM
Hello guys,
I have completed a development of Fiori application and the last step was to generate the Component-preload file.
I used the Gruntjs plugin grunt-openui5 to generate the file. After that I uploaded the file into my application project as we can see below.
After running the application in the Launchpad I noticed the Component-preload is loaded properly but the files (views, controllers, utils, i18) are also being loaded.
Although the Componet-preload is loaded it is not being used because the application is still pointing out to the single files if I try to debug.
I also tried to add the parameter data-sap-ui-preload="sync" in the index.html file but still didn't kick in.
any suggestion?
looking forward to hearing from you.
Kind Regards
Marcos Andrade
If a file/module is not found within Component-preload.js, then it will be loaded directly.
As Vladimir said, the reason the files were loaded individually because framework could not find them in component-preload.
Problem might with prefixes/namespace, naming etc within the component-preload file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I'm running into same issue. Even though I have Component-preload.js, each and every file is getting called. Below are the screenshot of my index.html, Component-preload.js and Network trace from Chrome browser.
index.html
Component.preload.js. Event I tried chaning the name to zui5app/Component-preload.
Network Trace
Appreciate your time and help.
Thanks,
Dheeram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Dheeram,
have you tried to change the name in the preload file from "zui5app.Component-preload" to "gov/doi/fbms/Component-preload" you can do the same wherever the file refer to that name mainly in the beginning of each row. this should work.
if it does not please send the file after you changed.
I haven`t used the gulpfile I used the gruntjs with ui5 plugin. But I know that both tools work fine.
hope it helps you.
Hi Marcos,
I changed. Attached is the new generated Component-preload.js file.
Thank you very for much for your help. I tried to grunt, but somehow lost in creating grunt file. When you get a chance can you please let me know how to create a Gruntfile.js and also some instructions(looks like SAP is recommending to use grunt to generate preload file with this tool)
Thanks,
Dheeram
Hello Dheeram,
you forgot to change the name convention in the modules of the preload file
"modules": {
"zaurapp/Component.js":
all the modules name has to follow the name space you have defined in this case should be.
"modules": {
"gov/doi/fbms/Component.js":
the video below explains how to install gruntjs and its plugin
How to install grunt and grunt plugins in windows - YouTube
and the plugin below is the one that generates the preload file
I have tried to check if there was anything wrong with prefix and namespace. It seems that everything is OK.
I assume that your preload file has been loaded if you check in the chrome debugger it should like this.
I would suggest you to try creating the file using grunt-openui5 and check whether you can any different result.
let me know the outcome it will be good to record your outcome.
Hi Marcos,
Thanks and appreciate your time and help.
My preload is getting called, but still all other files are getting loaded, which I don't individual files to load.
Can you please send me the index.html, preload and component.js file of your project with screenshot of your project? I would like to compare it with mine.
Do you have a sample of Gruntfile.js for UI5 preload? I would like to use it to generate my preload file.
Thanks,
Dheeram
Hi Marcos,
I solved this issue. It's issue with my folder structure and namespace that I used for views. I created a separate application from scratch and followed proper namespace as per folder structure.
I have another question. Can we have models(I have few json data models, they just contain static data) and properties files preloaded??
Thanks a lot for providing the hint in first place.
Thanks,
Dheeram
Hello Dheeram,
good to hear you made it.
Yes you can preload the properties files i18n smoothly.
As for json file, although the plugin allows us to upload files with json format I haven`t tried to merge them.
you can give it a go and see how it goes, I think this should work as well.
let me know.
Thanks
Hello Guys,
I made a tiny little mistake. In the preload file I defined the component name as freshfields/hcm/ole/rep
in the component file I defined the name as freshfields.hcm.ole.report
I shorted the report word in the preload file that`s why it didn`t work.
now it is working fine
thank you for your support.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That`s a good point. If the application is used for let`s say 5 countries we can have as a separate file because only one additional request will be made to the server.
I will take that into account when facing this situation.
Thanks
I also checked that there is no need to have the -dbg files in the project. I tested the Launchpad with the variable sap-ui-debug=true and the framework ignores the preload file and loads the normal resource files with that we can debug from there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your Component-preload.js was incorrectly generated therefore framework is using fallback and loads applications anyway by requesting normal application resources.
Your Component-preload.js file should look be similiar to example below
jQuery.sap.registerPreloadedModules({
"version": "2.0",
"name": "sap/ui/demo/Component-preload",
"modules": {
...
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.