tbranyen/use.js — pull request #17 by idflood (2012-04-30 20:19:38+00:00)
Title: Unexpected token return with r.js optimize and underscore

Hi,

I'had issues with optimization of a relatively large project so I created a small setup replacating the whole thing. It helped fix an issue in r.js (still not commited) but then found a problem with the use! plugin.

Here is the r.js issue and change needed to make the optimization process not crash: https://github.com/jrburke/r.js/issues/157#issuecomment-5402796
If this one line change is done to r.js then there is an error thrown in chrome:

Uncaught SyntaxError: Unexpected token return

which comes from this line

define('use!Underscore', [],return typeof _ !== "undefined" ? _ : void 0);

Applying both the r.js "patch" and this commit makes the setup works in all situations. Does this proposed change looks right?

the test setup: https://github.com/idflood/next-boilerplate.js