jrburke/requirejs — Issue #147: New way of passing required modules
Author: SimoneGianni
Created: 2011-12-01 15:33:44+00:00
State: open

We are using require.js for an heavy modularized JS application. For us require.js is something similar to the "import" keyword in Java.

Unfortunately, we have some situations where we "import" 10 or more modules, and the current syntax (array of strings, followed by function parameters in the same order) is a pain when there are more than 4/5 modules.

One possible solution could be to use an object instead of an array of strings, and pass an object to the function, something like :

```javascript
define({mod1: 'module1',mod2: 'module2'}, function(mods) {
mods.mod1.etc...
});
```

Such a modification should not break backward compatibility, but would greatly simplify the situation where many modules are used, connecting their names with their paths instead of having them in two lists difficult to maintain.

I can work on such a modification, however I wanted to share this idea and get some feedback on it before proceeding.