jwhitley/requirejs-rails — Issue #30: Exclude module dependencies in layered builds doesn't seem to work
Author: jmaicher
Created: 2012-01-21 17:09:51+00:00
State: open

Not sure if this relates to #20.

I have a module `common` which is related to all pages:

```javascript
define(['jquery'], function($) {
// ...
});
```

Each page has a separate module, f.e. `page1`:

```javascript
define(['jquery', 'some_other_dep'], function($) {
// ...
});
```

My `requirejs.yml` looks like this:

```yaml
modules:
- name: "common"
- name: "page1"
exclude: ["common"]
```

If I precompile my assets, then jquery should only be included in the optimized version of `common`.
Instead jquery is included in both, `common` and `page1`.

I assume this is has to do with the [rjs_driver](https://github.com/jwhitley/requirejs-rails/blob/master/lib/requirejs/rails/rjs_driver.js.erb) and how it builds a series of individual files. A comment says something about "async builds". What exactly do you mean by that?