I have been looking at combining my JavaScript files into one file, to gain some performance. Mostly it worked like a charm, but not for the jquery.templates, knockout.js and knockout.mapping.js libraries.
I have tried something as simple as manually copy/pasting the content of the three files into one file. As soon as I reference that new file instead of the three original files it fails – with undefined is not a function, but the error is not as important as why there is any difference at all.
Any idea why this happens?
Probably there is no line break at the start or the end of the files, which can lead to problems when they are concatenated.
Also, it can be that the order of the files must be correct. For example when file 1 contains function “Test” and file 2 uses this function.