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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:11:27+00:00 2026-06-01T12:11:27+00:00

Using Require.js and it works pretty solid. However, I’m reading about optimization (http://requirejs.org/docs/optimization.html) using

  • 0

Using Require.js and it works pretty solid.

However, I’m reading about optimization (http://requirejs.org/docs/optimization.html) using r.js.

To my understanding it bundles top-level defined modules into 1 file (great because: less http-calls, minified ) .

This seems fine when I only have 1 pagetype defined, i.e: 1 set of required modules to load. However, in any normal site, you’d have multiple pagetypes each requiring different modules.

Now, I’m just wondering how clever r.js really is? Does it take all the multiple pages (with different ‘requires’) into account when determining which modules to package together, so that I don’t end up with X bundled javascriptf-iles for X pagetypes, even though there’s substantial overlap in the modules included in each of these bundled scripts.

Any hints I need to give to the optimizer, is it handled automatically, etc?

Clarification much appreciated,.

  • 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-01T12:11:28+00:00Added an answer on June 1, 2026 at 12:11 pm

    What I understand is that the optimizer finds dependencies for a file by looking for require() calls, and makes a list of what it finds. (So it only finds dependencies passed to require() as literal strings.) Then the file is combined with its dependencies (recursively) into one file, and minimized.

    You can control what goes into a module in the configuration. Here’s a sample:

    ({
    
    baseUrl: "Website/Scripts",
    dir: "Staging/Scripts",
    modules: [
        { name: "main", include: ["Rotator"], exclude: ["jwPlayerDialog"] },
        { name: "jwPlayerDialog" }
    ],
    paths: {
        "jquery": "empty:"
    },
    fileExclusionRegExp: /^\.|Microsoft|modernizr|unobtrusive|\.min\.|\.debug\./
    })
    

    If you turn off minimization, you can easily see what’s being included in each file. A module could be included in more than one file. For example, the Rotator module above will be in main.js, and it will still be available as Rotator.js.

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

Sidebar

Related Questions

What will work faster - using PEAR package or require Some_Library.php files in code?
Would WCF work through normal USB connection or does it require WIFI when using
Is there any way to include php file using require and calling a php
I've been messing around with a backbone.js app using require.js and a handlebars templates
To use modular exponentiation as you would require when using the Fermat Primality Test
I'm trying to add jQuery using Greasemonkey's @require / @include method, but it doesn't
I require help to search a text file (log file) using c# and display
I am very new to JSF, and I am pretty confused about the best
I'm trying to accomplish the following, I'm sending a HTML email using PHP Mailer
I'm using PEAR's Mail package to send email from my script. I'm pretty sure

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.