# Class: ModuleReference

## ModuleReference

#### new ModuleReference()

Source:
  - core/serialization/serializer/montage-ast.js, line 144

### Extends

- Value

### Members

#### id

The absolute id of the module within the `require` package

##### Properties:

Name | Type | Description
--- | --- | ---
`value` | string |

Source:
  - core/module-reference.js, line 29

#### require

The require of a package.

##### Properties:

Name | Type | Description
--- | --- | ---
`value` | function |

Source:
  - core/module-reference.js, line 37

### Methods

#### resolve(otherRequire) → {string}

Resolves this module reference so that it can be required from otherRequire.

##### Parameters:

Name | Type | Description
--- | --- | ---
`otherRequire` | function | Require from another package that has the package of this module as a dependency.

Source:
  - core/module-reference.js, line 81

##### Throws:

If there is no mapping from this require inside otherRequire.

Type
  Error

##### Returns:

The module id to pass to otherRequire that results in this module.

Type
  string

##### Examples

    var ref = new ModuleReference().initWithIdAndRequire("core/uuid", montageRequire);
    ref.resolve(applicationRequire); // => "montage/core/uuid"

    var ref = new ModuleReference().initWithIdAndRequire("ui/main.reel", applicationRequire);
    ref.resolve(montageRequire); // => Error
    // because there is no module id such that montageRequire(id) can
    // return the module from inside your application