If you want automatic dependency management then LazyLoad is not appropriate. LazyLoad is appropriate if you just need a runtime loader and don't care about:
- Defining modules
- Tracking dependencies. From the lazyload github (emphasis mine):
Use LazyLoad when you need a small, fast, safe dynamic JS or CSS loader, but don't need the overhead of dependency management or other extra functionality that larger script loaders provide.
- An option for build-time optimization
It looks like LazyLoad just directly loads URLs and doesn't check for path mappings or if that module is already loaded. So I think your 2nd code snippet would probably look like this:
LazyLoad.js(["some/path/modul1.js", "some/path/modul2.js"],function(Modul1, Modul2){
Whereas RequireJS would let you do something like this:
require.config({
paths: {
modul1: 'libs/module1/blah.1.3.3-min',
modul2: 'libs/module2/foo.2.7.2-min',
}
});
require(["modul1", "modul2"],function(Modul1, Modul2){
And also define shims for what files need to be loaded before these modules.