I'm trying to include jQuery Mobile in a project that uses RequireJS for AMD, however, I do not want to load jQuery Mobile in as an AMD module. The idea behind this is that we will be using AMD for application specific logic but any external library dependencies such as jQuery will be brought into global scope by just manually defining script tags.
The problem I'm having is defining a script tag for jQuery mobile before RequireJS script tag seems to cause RequireJS to define an anonymous module and create a conflict that I don't understand. I looked at both the jQuery and jQuery Mobile code and they are set up to conditionally call the define()
method if it exists. Since I am including those tags before RequireJS loads, they should not be calling define()
. I double checked this with breakpoints and they indeed do not.
When I include jQuery Mobile I get the following error:
Error: Mismatched anonymous define() module: [object Object]
I don't understand how this is happening if jQuery Mobile isn't calling define()
. What am I doing wrong here? Is this something with jQuery Mobile's new conditional AMD support?