I am new to RequireJS and maybe this is an already discussed issue but I could not find a clear answer or opinion about this.
I have an application working with RequireJ
What you want is the RequireJS Optimizer.
The optimizer does the following (from the docs):
Here's one article on the topic for further reference.
Have a look also at r.js, the command line tool which includes the optimizer. Using r.js
, you can generate an optimized build from an application file main.js
with just:
node r.js -o build.js
where build.js
is a requirejs config file containing your build profile (baseUrl
, paths
, etc.).