mixu / gluejs

Build CommonJS modules for the browser via a chainable API
http://mixu.net/gluejs/
165 stars 13 forks source link

Including Backbone with a single copy of Underscore #26

Open moll opened 10 years ago

moll commented 10 years ago

Hey,

Trying out Gluejs in a real world context here, but having trouble understanding how it's supposed to be used.

Invoking it with, amongst other options, with:

        --basepath app/javascripts
        --include app/javascripts/node_modules/underscore/index.js
        --include app/javascripts/node_modules/backbone/index.js

Doing require("underscore") works from my own code, but when doing require("backbone"), it fails with Uncaught Error: failed to require "underscore" from index.js because of Backbone's attempt to load Underscore itself.

How should this be handled?

moll commented 10 years ago

This seems to come from the difference on how Node resolves dependencies (searching ancestor directories) and how Glue doesn't.