0
votes

How should I include jquery.mobile.js in my project so that I can use it with RequireJS.

When I add jquery.mobile.js in my project I start getting following error.

Uncaught Error: Mismatched anonymous define() module: function ( $ ) {
factory( $, root, doc );
return $.mobile;
}

I also followed this post. Separating jQuery Mobile (1.1.0) from AMD (RequireJS)

1

1 Answers

0
votes

Here is a working example. It includes Requirejs, jQueryMobile, Backbone, and Marinonette.

In the index.html file, you need to specify the main module for requirejs to load.

<script type="text/javascript" data-main="js/main" src="js/libs/require-2.1.2.min.js"></script>

In this example, the main module is under "js/main.js"

Inside, main.js, you specify the require.config and use define to load your modules.