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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:41:04+00:00 2026-06-09T14:41:04+00:00

I’m reading through the optimizer documentation for quite a while, but it seems like

  • 0

I’m reading through the optimizer documentation for quite a while, but it seems like I can’t figure it. The doc says:

The optimizer will only combine modules that are specified in arrays
of string literals that are passed to top-level require and define
calls, or the require(‘name’) string literal calls in a simplified
CommonJS wrapping. So, it will not find modules that are loaded via a
variable name:

OK so far so good. This basically means r.js won’t include nor crawl nested dependencies. Now lets assume we have a “main application” file which looks like the following:

require([ 'es5shim', 'tools' ], function() {
    console.log('fictive app entry point');

    require([ 'domready!' ], function( doc ) {
        console.log('domReady, loading GUI modules...');
        require([ 'GUI/window', 'GUI/header', 'GUI/content' ]);
    });
});

I guess the problem becomes pretty obvious here. r.js (the optimizer) creates that file by only linking es5shim.js and tools.js into it. Is there any good way / workaround to tell that optimizer, that it also should link the window.js, header.js and content.js files in this example ?

Of course the domReady plugin in this instance will get loaded and it will eventually execute the callback, but the structure itself here it seems, prevents the optimizer from doing its job.

Question are:

  • If I just would list all modules in the “Top require call”, would r.js also include+link all top require and define calls from nested and nested-nested modules into the main-app file ?

  • They are mentioning the include option for r.js in the Docs. Does it make sense here and if so, how to properly invoke it ?

Of course you don’t want to lose the option to lazy-load modules later-on, but for this kind of dependency (waiting for DOMContentLoaded), I hope there is a way to workaround that.

  • 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-09T14:41:05+00:00Added an answer on June 9, 2026 at 2:41 pm

    By default RequireJS doesn’t scan nested require calls because it assumes those are meant to load dependencies at runtime. You override this by setting

    findNestedDependencies: true
    

    in your optimization config. Hope that helps.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:

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.