I'm reading through Backbone Fundamentals and am currently on the section that describes how to build an app with RequireJS.
From what I understand, the idea behind shimming is that normally when you require modules, RequireJS figures out how to load their dependencies as well. But when you're trying to load a non-AMD module, this doesn't work (I don't know why, but that's a separate question). To get around this, you could set up a shim to say, "load X before Y".
require.config({
shim: {
'Y': ['X']
}
});
I see that you could use exports
to say, "put this non-AMD thing into a global variable instead of a module".
require.config({
shim: {
'Y': {
exports: 'globalY'
}
}
});
Um, what problem does that solve? Isn't the problem with non-AMD libraries just that RequireJS can't figure out the dependencies?