jam mod `backbone` fails #114

Open
me-ascii opened this Issue Dec 5, 2012 · 3 comments

Comments

Projects
None yet
1 participant

me-ascii commented Dec 5, 2012

Installed backbone module (with lodash) throw follow error:

Uncaught Error: Module name "underscore"
has not been loaded yet for context: _

Before any require/define called.

Configuration

// ...
{
    "name": "lodash",
    "location": "jam/lodash",
    "main": "./lodash.js"
}

"shim": {
    "backbone": {
        "deps": [
            "jquery",
            "underscore"
        ],
        "exports": "Backbone"
    }
}

me-ascii commented Dec 6, 2012

This is due to the order of the modules in the compiled js file.
Now in alphabetical order.
Error disappears when I move the lodash module before the backbone module.

Suggest using the order based on the dependencies of the module

me-ascii commented Dec 7, 2012

To maintain the correct order of the modules I have to list them in include (via -i)

jam compile -i lodash -i backbone -o build.js

But it applies only to simple examples

me-ascii commented Dec 9, 2012

More convenient trick is to manually patch require.config file (change the order of modules)
But the next time you do jam install you will need to be repeated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment