Check RequierJS config overrrides
by NesterOne
HTML
<script src="http://requirejs.org/docs/release/2.1.14/comments/require.js"></script>
JavaScript
var req1 = requirejs.config({
paths: {
"jquery": "http://code.jquery.com/jquery-2.1.1",
"foo" : "http://localhost:8000/foo",
"jrs" : "."
},
shim: {
"foo" : {
exports : "foo"
},
"jrs/foo" : {
export: "foo"
}
}
});
req1(["jquery", "jrs/foo"], function ($, foo) {
alert($);
alert(foo);
});
var req2 = requirejs.config({
paths: {
"underscore": "http://underscorejs.org/underscore-min",
"bar" : "http://localhost:8000/bar"
},
shim: {
"foo" : {
exports : "bar"
}
}
});
req2(["underscore", "bar", "foo"], function (_, bar, foo) {
alert(_);
alert(bar);
alert(foo);
});