Great article - currently implementing the idea a bit differently, instead of creating a lazy object on the module I 'override' the existing ones and for loading on routing I kindof assume file structure and load everything for that route based on a json file that is generated with node (based on the file structure) 'dependencies.json':
"Home" : ["controllers/home/HomeCtrl.js", "directives/home/CustomDtrv.js"],
"About" : ...
I don't believe the overriding will be a problem and will look a lot better to other developers working on my project so they don't need to remember another thing about setting up controllers, directives, etc.As for the separate 'dependencies' json file this was more of a concept not sure of the advantages/disadvantages except that the developer only needs to put the file in the right folder to load it for a route...
Any thoughts?
The only problem I found with doing it this way was minification... Unfortunately I had to generate the json then load it then require it.... require optimization had no idea what I was doing.
As a result I just made a grunt task that could load multiple require modules. npm require-wild Eh it works for right now.
Thanks for the article!