When writing an application using RequireJS the reuired files are stating their dependencies using the define( ['actual dependency name'], function (dependency, variables, ...) {}) which is all nice and dandy for using just one or two, but once you start having deeper dependencies it become a little bit complicated and not very readable or maintainable, i.e.:
define(['modules/module1', 'modules/module2', 'modules/module3', ...],
function (module1, module2, module3, ...) {});
If I add or remove a dependency I have to rewrite my arguments list in the callback function as well, again – not very maintainable…
Is there a better method of doing this? Am I missing something very simple?
Yes, you can be explicit like this:
which should alleviate your maintenance trouble 😉