I'm trying to figure out if (and how, if it's possible) to use the RequireJS optimization tool to include not only my JavaScript modules, but also my "text!" modules. I'm working on a Durandal app that uses "text!" modules for views.
Sometimes we have users who get a timeout trying to load a view. Here's an example error:
Error: Load timeout for modules: text!views/primaryapplicants.html
http://requirejs.org/docs/errors.html#timeout
I've got another question I just posted about handling that timeout. I can't figure out how to intercept it and try again. I know the module definition is valid, it's just that customers may have a network connectivity issue--especially if they're on a cell phone.
However, as I've continued to ponder this, I realize that if I could simply package the entire app up into a single file, then we could avoid the extra HTTP calls--which might cut down on timeouts like this. It would mean the app either loads, or it doesn't--instead of the possibility of "partially" loading.
This app does not have a large number of views. I estimate that adding every view would add around 20kb with gzip compression.
So, is it possible to package these "text!" modules up somehow?