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 9052043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:04:05+00:00 2026-06-16T13:04:05+00:00

When executing the following ‘main’ module, I get a TypeError: OrdersPage is not a

  • 0

When executing the following ‘main’ module, I get a “TypeError: OrdersPage is not a constructor”

require(
    [
        'app/pages/orders/OrdersPage'
    ],
    function(OrdersPage) {
        'use strict';

        new OrdersPage();
    }
);

Turns out that when I am inside function(OrdersPage), “OrdersPage” is undefined. So the question is why is it undefined – in spite of defining OrdersPage as a dependency?

Here’s the code for OrdersPage, which is actually being hit, but AFTER the above error is printed:

require(
    [
        'backbone'
    ],
    function() {
        'use strict';

        console.log('In OrdersPage');

        return Backbone.View.extend({

        });
    }
);

In summary, the console output is as follows:

TypeError: OrdersPage is not a constructor
In OrdersPage

This tells me that the OrdersPage module is being loaded after the ‘main’ module has been loaded and executed, which is too late!

Edit 1
A very simple project demonstrating this issue is available here.

Edit 2
I have already declared Backbone in my RequireJS configuration:

require.config({
    // Initialize the application with the main application file
    deps: ['main'],

    paths: {
        // jQuery
        jquery:                      'vendor/jquery-1.8.3',

        // Underscore
        underscore:                  'vendor/underscore-1.4.3',

        // Backbone
        backbone:                    'vendor/backbone-0.9.9',

        // Templating
        handlebars:                  'vendor/handlebars-1.0.rc.1'
    },

    shim: {
        backbone: {
            deps: ['underscore', 'jquery'],
            exports: 'Backbone'
        },

        handlebars: {
            exports: 'Handlebars'
        },

        underscore: {
            exports: '_'
        }
    }
});

require(
    [
        'app/pages/orders/main'
    ],
    function() {
        'use strict';
    }
);
  • 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-16T13:04:08+00:00Added an answer on June 16, 2026 at 1:04 pm

    You should be using define(), not require(). They are very similar, but require() does not do anything with the returned value and does not set up a module.

    define(['backbone'], function() {
        'use strict';
    
        console.log('In OrdersPage');
    
        return Backbone.View.extend({
    
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get an exception while executing following piece of code bool FieldValueMessage::Get(const std::string &field,
while executing the following query, i get an error that there's an error in
By executing the following i can get the information about methods Type t=typeof(someType); MemberInfo[]
When executing the following code: url= http://192.168.2.171/LoginAuthentication; $.ajax({ url: 'url', type: 'GET', success: function(res)
I am executing following sample program of httpclient of GET method. import org.apache.commons.httpclient.HttpClient; import
When executing the following script, I get the error: Msg 207, Level 16, State
when executing the following stored procedure I get Invalid Object Name dbo.Approved. The object
Executing the following C code #include <stdio.h> int main(int argc, char **argv) { char
Executing the following NHibernate.Linq statement raises a could not instantiate: Reservation001.Services.ReservationDto NHibernate.QueryException containing an
I get an error while executing the following psql statement inside a bash script:

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.