I'm building a site which has so many widgets. I'm using requirejs to load each widgets logic as a module.
Eg: In my homepage 20 widgets are there & I'm using require config to load all widgets js file. I can't optimize all files to a single js file using r.js during build process, because the widgets can be altered from backend. It leads to 20 extra http request.
require({
baseUrl: 'http://example.com/',
paths:{
widget1:'app/wid1',
widget2:'app/wid2',
....
widget20:'app/wid20'
},
waitSeconds: 30
});
Question: Is it possible to dynamically merge all modules into a single file using any server side technique, to save http request?.