Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.js - errors in build.traceDependencies result in: Error: Module loading did not complete... #187

Closed
pixelhandler opened this issue Jun 8, 2012 · 2 comments

Comments

@pixelhandler
Copy link

the project I am working on is at : github.com/pixelhandler/vertebrae the main.js w/ config: src/main.js and the build.js : build.js

I updated from v1 to use the new v2 and the build process is not working using: r.js -o build.js

I've tried changing from many modules to one module in the build.js and the same result:

Tracing dependencies for: '1st module in the list'
Error: Module loading did not complete for: '1st module in the list', `dependencies...`
...
  at Function.traceDependencies (/usr/local/lib/node_modules/requirejs/bin/r.js:16373:19)

I've added to my main.js and build.js the shim for backbone.js

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

Also tried adding to build.js : mainConfigFile: './src/main.js'

How do I debug this in r.js ?

Best regards,

-Bill Heaton

P.S. this is the same project you used to test during patch for 1.0.7

@jrburke
Copy link
Member

jrburke commented Jun 9, 2012

This was due to the "paths" configuration for "vendor" and "facade" both pointing to the "facade" module. Once I changed the paths config to be "vendor": "vendor", then it the build completed.

I committed a change to r.js that should give a better error message in this case. You can try it here:

https://raw.github.com/jrburke/r.js/master/dist/r.js

Also, side note: I noticed some of the module, like utils.js could save some typing from using the "sugared" form of modules:

define(function (require) {
    return {
        "ajaxOptions": require("utils/ajax-options"),
        "debug": require("utils/debug"),
        "docCookies": require("utils/cookies"),
        "lib": require("utils/lib"),
        "storage": require("utils/storage")
    };
    // the shims should only extend native JavaScript Objects when needed, e.g. Object.create
});

@pixelhandler
Copy link
Author

Thanks James! yes, the sugared form does save some duplications and keystrokes. The updated error message really clears up the mistake on my end.

Error: Module loading did not complete for: utils, utils/debug, utils/lib, utils/storage, facade, vendor
The following modules share the same URL. This could be a misconfiguration if that URL only has one anonymous module in it:
/Users/billheat/code/community/pixelhandler/vertebrae/public/facade.js: facade, vendor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants