I'm working on a library that is used in a number of web applications. The library itself does not use RequireJS - it's written in node, and then bundled with browserify - however, some of its dependents are using a RequireJS shim to include the library.
What we've found is that the RequireJS shim used by our dependents breaks with an "mismatched anonymous define()" error, if our library depends on a library that includes an anonymous define module, such as this one from the lodash source:
// Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module.
define(function() {
return _;
});
I've found the RequireJS documentation on this problem; but all of its solutions seem to be with the assumption that the library importing the library with the anonymous module is using RequireJS, which isn't the case here.
How can I deal with this so that the downstream libraries don't need to do any special handling in order to require our library? Ideally, it'd be nice if we don't have to add custom logic for every library that we use with an anonymous module definition in it, too.