Open mbektimirov opened 11 years ago
I was wondering about the same. I basically need to speed up the first page loaded by the user by minimizing the amout of initial HTTP round-trips. Is there any example about how to do that in Aura?
Sure it is.
You can have a look at different ways to do it :
https://github.com/sbellity/aura-app-build/blob/master/Gruntfile.js https://github.com/hull/hullagram And cf. #250
Let me know what works best for you...
sbellity/aura-app-build looks good, thanks @sbellity ! By the way, hullagram does not use requirejs so those modules can be simply combined together.
Hey @mbektimirov, cool ! Actually hullagram does use resuirejs.. It's just hidden in the Hull.widget method ;)
If you are interested, you can have a look at how it's done in hull/hull-js
I could build all my widgets to single file, but now I'm struggling with widgets local components loading. Requirejs is trying to load it from network instead the 'define' definition. For example, I have a widget 'infocard' with main.js and templates by path './widgets/infocard/templates/splash.html'. After compiling I see a lot of errors like this:
GET http://localhost:3000/scripts/widgets/infocard/templates/splash.html 404 (Not Found)
I don't understand why requirejs wants to load this templates and additional scripts through GET request, because they are all compiled in one file.
Could you share a smaller version of your project reproducing this issue so we can investigate further? If not can you see if explicitly setting the baseUrl in your source eases the issue at build time?
@mbektimirov I'm having the same problem - were you able to solve this issue?
Is it possible to combine all widgets and templates to a single js file with r.js? Now widgets directory is just copying to dist, but how to do correct concatenation and compression with all widgets?