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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:12:57+00:00 2026-06-02T05:12:57+00:00

I have a feeling that the title just might not be explanatory :) Setup

  • 0

I have a feeling that the title just might not be explanatory 🙂

Setup

Suppose that I have the following structure:

enter image description here

where app.js files are main bootstrapping/entry modules for the applications that look like this:

app01

require.config({});

require([
    'app/component1.js'
], 
function(component){
    // do something with component1
});

app02

require.config({});

require([
    'app/component2.js'
], 
function(component){
    // do something with component2
});

which both work with appropriate index.html files.

I have a RequireJS build configuration file (assume correct placement related to the paths) for app01:

({
    appDir: 'apps/app01',
    baseUrl: '.',
    dir: 'built_apps/app01',
    optimize: 'closure',
    paths: {
    },

    modules: [
        {
            name: 'app'
        }
    ]
})

which works just fine. Similar file (replacing app01 with app02) works just fine for app02.

Problem/target

Now I want to be able to run RequireJS build tool (using Google Closure with Rhino under Ant, not that it really matters in this case) for both app01 and app02 applications using the same build configuration file and, preferably, without actually listing all the apps by name (since the number and names may vary over time).

Basically I expect (or rather hope) to have something like this:

({
    appDir: 'apps',
    baseUrl: '.',
    dir: 'built_apps',
    optimize: 'closure',
    paths: {

    },

    modules: [
        {
            name: 'app*/app' // notice the wildcard
        }
    ]
})

which would run over built_apps directory, find all apps under app*/app and optimize each one of them.

I know I can use Ant to create such build configuration file on the fly per app, run build against it and then clean up, but I’d rather have RequireJS solution.

Is there a way to do something like this with RequireJS?

  • 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-02T05:12:58+00:00Added an answer on June 2, 2026 at 5:12 am

    There’s no built-in wildcarding configuration for RequireJS. One way or another, you’ll need code to do this. I’ll observe that what you’re asking for here amounts to translating a wildcard into some kind of implicit iteration on the module objects, akin to what mustache.js provides for its templates. IMO, that’s a fairly brittle and limited approach in this context.

    Instead, I recommend generating your modules array programmatically in JavaScript right in the build config. Recall, the build config is JavaScript not just a JSON data structure. This gives you sophisticated scripting capabilities there.

    I’ve done this kind of scripting in the build config for the requirejs-rails gem. Here’s an example gist that shows what r.js would see at build time.

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

Sidebar

Related Questions

I have a feeling that this query is pretty easy to construct, I just
I have an Ember.js model that's basically just an ID, a title, a body,
I have the feeling that is easy to find samples, tutorials and simple examples
I have a feeling that I already know the answer to this one, but
I have a feeling that there must be client-server synchronization patterns out there. But
I have the feeling that Flash -based ( or Silverlight -based) websites are generally
I have a feeling that I am going to ask a stupid question, yet
I somehow have the feeling that modern systems, including runtime libraries, this exception handler
This is an SDL problem, however I have the strong feeling that the problem
I have a link being generated that looks like so: <a target=_blank title=Test href=file:///c:/test.xls>Test</a>

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.