You are wrong, because r.js does automatically resolve dependencies. If you have a main.js file with this:
define(["foo"], function (foo) {
});
Then if you ask r.js to create produce an optimized module out of main.js, it will include the code for module foo into the build.
Some caveats:
- It is possible to tell - r.jsto exclude modules. So if a module you think should be in an optimized bundle is absent, it may be that it has been excluded. (You know how you are using- r.jsbut if you use a bundle produced by someone else and you wonder, then this may be the answer: they specifically excluded a dependency from the build.)
 
- r.jsdoes not find nested dependencies unless you tell it to. For instance:
 - define(function () {
    require(["foo"], function (foo) {
    });
});
 - r.jswon't find that- foois required unless you set- findNestedDepencenciesto- truein your build config.
 
- r.jscan find only dependencies that are specified in the form of a list of string placed as a literal in the location where the- requireand- definecalls expect dependencies. So if you do:
 - define(function () {
    var deps = ["foo"];
    require(deps, function (foo) {
    });
});
 - Then - r.jswon't know that- foois a dependency, because in- require(deps, ...your dependencies appear as a symbol reference, not as a list of strings. You would have to specify- fooas a dependency manually in the build configuration. There's no flag to turn on to make- r.jsfind these cases.