Optimizer Require.js - transition problem

Good morning,

This morning I was busy with the optimizer Require.js and started to work with difficulty.

I run windows 8 and created a modular backbone.js application, which I am now ready for a package for deployment (production). Now I would like to optimize file theses (concat and minim), the r.js optimizer seems to be just a trick.

The problem I am facing is trying to run the classpath command.

java -classpath path/to/rhino/js.jar;path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js main.js 

Will output an error - Error: could not find or load the main class org.mozilla.javascript.tools.shell.Main

I am confused because I'm not sure where this package should be, will it not already be part of the optimizer / compiler?

My directory structure is as follows

 build - compiler.js js.jar r.js app js -> backbone and application files here css images 

I would appreciate any light that could be shed on this, this is the first time I run the require.js optimizer.

+1
source share
1 answer

The command you are using is trying to start r.js with main.js as the entry point, and not perform the optimization (remember that the Optimizer is not the main component of r.js ). You probably found the team in r.js README ; the correct command is in the same file in the Optimizer section:

 java -classpath path/to/rhino/js.jar;path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js -o path/to/buildconfig.js 

You will need a build profile file, which should be fairly simple in your case. More information right on the RequireJS page.

I highly recommend using Node.js instead of Rhino, it is much faster and saves the Java / classpath dependency configuration.

+1
source

All Articles