Creating a reusable RequireJs library
问题 Given the following simplified scenario, how could I best construct my reusable component so that it is correctly consumable by another application, such that foo.js prints 23? Reusable Component: /home.js /main.js /stuff foo.js -- /home.js: define([], function () { return 23; } /stuff/foo.js: define(['home'], function (home) { console.log(home); } // prints 23 Consumer Application: /app.js /main.js /home.js /views template.html /bower_components /myReusableComponent /home.js /main.js /stuff