Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9095591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:38:33+00:00 2026-06-16T23:38:33+00:00

I’m trying to create a site using Jquery Mobile, Backbone and RequireJS. But the

  • 0

I’m trying to create a site using Jquery Mobile, Backbone and RequireJS. But the problem I am having is the site randomly break and reasons why the break are different:

  • JQuery is Undefined
  • Backbone is Undefined
  • Extended views of backbone are not defined
  • etc etc etc

And I cannot pinpoint our the reason why because it works sometimes but when I refresh it, it suddenly doesn’t. I’m loading my code like this(libraries followed by views):

requirejs(["/js/libs/jquery-1.8.3.min", "/js/libs/jquery.mobile-1.2.0.min", "/js/libs/underscore-1.4.3", "/js/libs/json2", "/js/libs/backbone.0.9.9"], function($,JQM, underscore, json2, bb) {

});

requirejs(["/js/views/pageview", '/js/views/home'], function(util) {

    HomeView = new HomeView({el : '#home', 'id' : 'home'})
});

Am I doing something wrong by doing it this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:38:34+00:00Added an answer on June 16, 2026 at 11:38 pm

    Libraries like jQuery Mobile, Backbone and Underscore are not AMD modules, just plain old javascript files. And because they’re not modules, they don’t declare dependencies, they just expect to find $ or _ in the global scope.

    The loading order of RequireJS is indeterministic – so there’s no telling which of them will load first. If Backbone is evaluated first, it won’t find the window._ it’s looking for and crashes.

    RequireJS supports non-AMD modules via the shim config (see docs), which allows you to declare the dependencies between these libraries. After configuring the shim, RequireJS knows how to load the dependent libraries before those that depend on them.

    A typical RequireJS config with the shim element would look something like:

    requirejs.config({
      //libraries
      paths: {
          jquery:       'libs/jquery/jquery',
          backbone:     'libs/backbone/backbone',
          underscore:   'libs/underscore/underscore',
          jquerymobile: 'libs/jquery.mobile-1.2.0/jquery.mobile-1.2.0',
      },
    
      //shimming enables loading non-AMD modules
      //define dependencies and an export object
      shim: {
          jquerymobile: {
              deps: ['jquery'],
              exports: 'jQuery.mobile'
          },
          underscore: {
              exports: '_'
          },
          backbone: {
              deps: ['jquerymobile', 'jquery', 'underscore'],
              exports: 'Backbone'
          }
      }
    });
    

    The paths part is not mandatory, you could just use the file paths as keys in the shim section. However, when you use the paths aliases, you can then import those libraries with the short name instead of the whole path:

    define(['jquery', 'backbone'], function($, Backbone) { ... });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.