I've read a lot of articles on AMD solutions like RequireJS or module loaders that follow CommonJS style in Javascript.

Let's say I have an app splitted in this parts:

  • App definition that rely on the framework i use
  • Model 1 that rely on App definition and framework
  • Model 2 that rely on App definition, Model 1 and my framework

I may write each part as a RequireJS module or a common JS module and split my project in how many files I want but what's the advantage of writing each part as a module or splitting them in many files and then load them in the right order (to avoid dependency problems) maybe concatenatening all the files in a big one to reduce HTTP requets (as done by r.js optimizer)?

Edit
Report