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

  • Home
  • SEARCH
  • 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 8197753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:48:20+00:00 2026-06-07T05:48:20+00:00

I came across this article about about backbone apps with requirejs. There is one

  • 0

I came across this article about about backbone apps with requirejs. There is one thing that seems really odd. Whenever they need a reference of Backbone, Underscore or jquery in my module I have to require them:

define([
  'jQuery',
  'Underscore',
  'Backbone',
  'collections/projects',
], function($, _, Backbone, ProjectsCollection, projectsListTemplate){
  var projectListView = Backbone.View.extend({
    el: $("#container"),
...

So is there really a need to go that way? Isn’t a bit over engineered? Couldn’t I just load Backbone and its dependencies before I start my app and use them as global objects like I would do it without requirejs? Or miss I something here?

  • 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-07T05:48:22+00:00Added an answer on June 7, 2026 at 5:48 am

    There are pros/cons either way.

    Advantage:

    Your dependency management is completely controlled by require.js, instead of relying on synchronously-loaded globally-scoped libraries. It’s elegant, modular, and is probably The Right Way to do things.

    Advantage:

    It’s easier to swap in versions of libraries, particularly per-module. I’ve honestly never seen this in practice – it seems like a “what if” situation rather than something practical. If you do then you’re probably hacking something together anyway, sacrificing the “code elegance” you’re getting by using them as modules in the first place.

    Disadvantage:

    You get a lot of boilerplate imports.

    define(['jQuery', 'underscore', 'backbone', 'raphael', ...],
    

    In a large app, it could take a half dozen library dependencies before you get to your dependencies. In every module.

    The redundancy feels especially unnecessary for Backbone-heavy apps, where each module is probably defining a Backbone model/controller/view – almost every module requires Backbone.

    You could wrap them all into a single Lib module that you’d reference like Lib.$(...) or Lib._(...), but that’s just moving the boilerplate out of the imports and into the code. It also negates advantage #2.

    So which one?

    I’d say to look at each library individually and decide whether or not it should be global or its own imported module.

    If you’re going to use the library almost everywhere (e.g. jQuery, Backbone), then just keep it global.

    For other libraries you might only use them in a couple views (e.g. Raphael.js). In that case, import it as a module.

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

Sidebar

Related Questions

I came across this article on Code Project that talks about using an abstract
Just came across this article about NOSQL patterns (not mine). It's covers lots of
I came across a few articles like this one , which suggest that some
I came across this article about detecting VMWare or Virtual PC http://www.codeproject.com/KB/system/VmDetect.aspx and I
I just came across this article about WPF performance on Touch/Tablet devices. In the
I was reading about imports in python and came across this effbot article about
I came across this article , which mentions wrapping everything in a single element
I recently came across this article , discussing how to leverage mod_cluster to create
1) I came across THIS ARTICLE today, which states: The most popular method in
As I noted in another SO question, I came across this article . The

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.