The only difficulty in debugging modules loaded with RequireJS is that if a module is loaded only if conditions X happens and this condition does not exist when the application is first loaded, you have to wait until the condition occurs before you can put breakpoints on the module's code.
For instance if you want to debug the function bar
in module foo
and foo
is loaded like this:
if (X) {
require(["foo"], function (foo) {
foo.bar();
});
}
You'd have to trigger condition X
before you can start adding breakpoints inside foo.bar
. Most likely, you'd want to put a breakpoint at the location of the foo.bar()
call so that you have the opportunity to add a breakpoint inside foo.bar
.
This is true in Chrome and Firefox, and probably in other browsers that offer debugging facilities.