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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:37:38+00:00 2026-06-17T06:37:38+00:00

I am trying to optimize a significant number of javascript files with RequireJS, but

  • 0

I am trying to optimize a significant number of javascript files with RequireJS, but I am having trouble wrapping my head around how to properly build the scripts with the optimizer and load them in the browser in the desired way.

While the following description is rather specific, I would imagine quite a few other people are encountering the same challenges. (Or they have made wiser choices in their requirements!)

I am using bower to download a catalog of scripts, and I would like to include those scripts (or parts of them) in my web-page.

Additionally, while testing I essentially never want to have the browser retrieve the individual bower scripts. The local test framework responds to requests serially, so this is quite slow. I would like to use the RequireJS optimizer, or some other method, to combine all the downloaded bower scripts into one file.

In contrast, my own code been broken out into a long list of Coffeescript files, and I would like to use the RequireJS CS plugin to compile them for the browser.

When developing then, I would expect my browser to load something like the following:

  • components.js
  • main.js
    • csmain.coffee
    • my_module.coffee

The components.js would consist of the following files from bower’s components directory e.g.

  • jquery: jquery/jquery
  • jqueryui:
    • jquery-ui/ui/jquery.ui.core
    • jquery-ui/ui/jquery.ui.datepicker
  • amplify:
    • amplify/core/amplify.core
    • amplify/request/amplify.request
  • bootstrap:
    • bootstrap/js/bootstrap-transition
    • bootstrap/js/bootstrap-alert
    • bootstrap/js/bootstrap-button
    • bootstrap/js/bootstrap-carousel
    • bootstrap/js/bootstrap-collapse
  • lodash: lodash/lodash

In production, the browser would load one file, say all.js.

So my question is: if I use RequireJS what goes into the browser main.js and build script to achieve the partial and completely optimized builds. I have spent a disproportionate amount of time on this problem, and the number of inexplicable and arcane errors from RequireJS has been tragically lengthy – to the point where I could not identify severable prohibitive issues. It just doesn’t seem to be the tool for the job, but I would be happy to be corrected.

What I have for an optimization script resembles the following (in YAML notation):

baseUrl: "../media/my-scripts/"
optimize: none
out: build/all.js
stubModules:
 - cs
 - coffee-script
paths:
  cs: "../../scripts/components/require-cs/cs"
  'coffee-script': "../../scripts/components/require-cs/coffee-script"
  usf: "./main"
  components: "../compiled/components"
name: usf
logLevel: 0
shim: # ...

It seems that the problem I wish to solve is rather straightforward, yet the solution not forthcoming. RequireJS, albeit brilliant, is dramatically more complex than what I need. Almond.js is an alternative for loading the modules – but the problem rests with the lack of an alternative suitable optimizer.

I would be grateful for any thoughts on what options may be available for using r.js to achieve the above, or alternatively what suitable alternative optimization solutions may exist.

  • 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-17T06:37:39+00:00Added an answer on June 17, 2026 at 6:37 am

    Not having found an answer, I wrote YAMDO to solve this problem EDIT I have since deprecated that project and come to rest upon the awesome Browserify project.

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

Sidebar

Related Questions

I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
I am trying to optimize this query as good as possible,but still i am
I'm trying to optimize a query so I plugged it into LINQPAD but I
I'm trying to optimize my build process (in development) in term of time to
I'm trying to optimize my queries a bit but can't quite get it right.
I'm trying to optimize the memory usage of an iOS app, and I'd like
I'm trying to optimize my code using Neon intrinsics. I have a 24-bit rotation
I'm currently trying to optimize my program. I have a large database which consists
I'm trying to optimize the size of my Delphi classes so that they take
I am trying to optimize my TCP/IP settings such as TCP Window size, MSS

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.