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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:54:44+00:00 2026-05-20T18:54:44+00:00

We have just started using requirejs in our project and we are loving it.

  • 0

We have just started using requirejs in our project and we are loving
it. Currently we are just using it to manage our many jQuery plugins
the site runs on, so are barely scratching the surface of its
potential… but due to time constraints this has to wait.

I’m having some problems getting the optimizer play as I’d like it to,
I wonder if you could tell me if it is even possible to do this.
My directory structure:

> /common/
> /common/*.js - common plugins used on most pages on the site
> /infrequent/
> /infrequent/infrequentModule.js
> /infrequent/ckeditor
> /infrequent/ckeditor/1000s.js
> /require.js
> /jquery.js
> /main.js - this file contains all scripts in common. It looks at the page and call the necessary plugins.

Optimization/build hopes:

  • main.js would contain all the common scripts. On most pages this script will be the only one loaded (except require.js)
  • main.js looks at the page, if it see’s that it needs an infrequent plugin/module it loads that async. So on a infrequent page I may load require.js, main.js and infrequentModule.js.

I have tried various methods in the build script to exclude and
include files to get the desired results but to no avail.
Does anyone have any ideas or know if this is, in fact, even possible?

  • 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-05-20T18:54:45+00:00Added an answer on May 20, 2026 at 6:54 pm

    OK, so I got some great answers on the google group for require.js – http://groups.google.com/group/requirejs/browse_thread/thread/359b02473f4e707

    The following is a useful answer I was given that I hope may help out someone else…

    Hi, I am currently doing this in one of my projects, here is my
    build.js:

    paths: { 
                    //load libs from cdn 
                    "jqueryUI": "jqueryUI", //temp static file for build 
                    "swfobject": "swfobject", //temp static file for build 
                    "Templates": "../Templates/Settings" 
            }, 
    modules: [{ 
                name: "appName", 
                            excludeShallow: ["jqueryUI", "swfobject", "Modules/ 
    module.preferences"] 
            } 
    

    Then in one of my modules I have a require call for Modules/
    module.preferences which I execute when I need it:

    function loadPreferences(){ 
     require(["Modules/module.preferences"],function(){ 
                         //Execute some init code after the module has 
    loaded 
             }) 
     } 
    } 
    

    This achieves what you described where I have require and main loaded
    on page load, then module.preferences loads async when I need it.
    Hope that helps, Jeff.

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

Sidebar

Related Questions

Have just started using Google Chrome , and noticed in parts of our site,
We have just started using VisualSVN, TortoiseSVN and ankhSVN plug-in to handle our source
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have just started using silverlight 2 beta and cannot find how to or
I have just started using Boost 1.36. These libraries would be very useful in
I just started using SVN, and I have a cache directory that I don't
I've just started using Java's enums in my own projects (I have to use
I’ve only just started using ASP.NET MVC, and I have a somewhat trivial question:
Just getting started using MVC in ASP.NET, I'm going to have it so users
I have been looking at using TDD and implementing proper testing (only just started

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.