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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:26:50+00:00 2026-06-09T16:26:50+00:00

I have the following (extremely simple) module definition, in CoffeeScript: # backbone/routers/appointments_router.js.coffee define [app,

  • 0

I have the following (extremely simple) module definition, in CoffeeScript:

# backbone/routers/appointments_router.js.coffee
define ["app", "underscore", "backbone"], (App, _, Backbone) ->
  console.log(Backbone)

And here’s my config and stuff:

# application.js.coffee
requirejs.config
  paths:
    underscore: "lodash.min"
    backbone: "backbone"
    appointmentsRouter: "backbone/routers/appointments_router"
    "backbone-relational": "backbone-relational"

requirejs ["app", "underscore", "backbone", "appointmentsRouter"], (App, _, Backbone, AppointmentsRouter) ->

Here’s what’s happening: when I load my page, I get undefined in the console, even though Backbone is listed as a dependency. What’s even more puzzling is that if I type Backbone into the console, Backbone is defined.

How could it be that Backbone is ultimately getting evaluated, but my appointments_router.js.coffee doesn’t know about Backbone?

  • 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-09T16:26:51+00:00Added an answer on June 9, 2026 at 4:26 pm

    Underscore or Backbone aren’t AMD compliant, so defining the path isn’t enough. Luckily Require.js offers the shim -functionality as an answer to this.

    So you’ll have to add something like this

    requirejs.config( // shouldn't this be just require?
      paths: ..., // don't change these
      shim: {
        "underscore": {
          exports: "_" // define the export
        },
        "backbone": {
          deps: ["underscore"], // define dependencies for backbone
          exports: "Backbone"
        }
      }
    );
    

    hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C#, I have the following extremely verbose syntax for pulling a simple list
I have an extremely simple JSON object that looks like the following: var data
Let's say, for instance, I have the following extremely simple window: <Window x:Class=CalendarGenerator.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
I have following question on adobe omniture How we can register an iPhone app
I have an extremely simple example trying to use Data Annotations with unobtrusive javascript
I have a simple class like the following: class Record { public Record(string fp1,
I have an extremely simple control i'm trying to render which looks like this:
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>

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.