-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We���ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r.js optimizer: Cannot read property '0' of undefined at Function.findAnonDefineFactory #157
Comments
Still trying to figure out what is wrong, I modified one of the last line of coffee-script.js temporarily from
to
With this modification the optimization doesn't crash but the resulting js doesn't run properly neither. It throw an error about
This is too much "strange" errors, I must be missing something essential here. |
I've created a minimal project reflecting the setup I'm using: https://github.com/idflood/next-boilerplate.js The r.js optimize function is called there: https://github.com/idflood/next-boilerplate.js/blob/master/src/scripts/_build.coffee#L72 In this minimal setup the app and tests runs just fine using the non optimized files. The problem only occur when running edit: updated links |
Thanks for the test case! I did this following modification to parse.findAnonDefineFactory(), from this:
to this:
and the build completes for me. However if you want to confirm that fixes the issue for you, that the code runs correctly after a build, then I'll push a fix. Although the fix may end up going in the dev2.0 branch as that is the current development focus. |
Thanks, it looks like it is compiling with this modification but the output gives a javascript error. I've my next-boilerplate.js directory in a httpdocs apache directory and when accessing the index.html from
In fact it is the same error as posted before, it appears here:
Maybe this remaining issue is caused by the use! plugin, what do you think? |
Right, that looks like a use.js error, when it tries writing out the define() call with its write() method. I'll put a fix in for the build parse step, putting this in the 2.0 milestone. |
I've played with this a little more and may have found a solution on the use.js side: The change you proposed above is still required to make the optimization works so maybe this should get committed. Thank you : ) |
Fix committed to dev2.0 branch as that is the active dev branch. |
Any chance of backporting this one line fix? Or maybe, create a requirejs-dev package on npm so that it become possible to target it from a package.json file (don't know if this is a good idea). |
I'm hoping to just do the 2.0 release in a short while, instead of managing two trees. However, I labeled this with a "1.0 maintenance?" label for consideration in any future 1.0.x release if the 2.0 one takes too long. |
Ah, I didn't expected that the 2.0 branch will be shortly released. I have a lot of things to fix and build on my project so take your time, I bet the 2.0 will be released long before I finish some major features. |
HI,
I have a relatively large project using most of the require.js plugins. The current master branch of this project already use r.js to optimize the final build and is working nicely. However r.js breaks when optimizing the dev branch (both branches runs fine without optimization). There are two major differences between the two branches. The dev uses the cs! plugin and also namespace.coffee. There is probably something wrong with one of these but I find debugging this with the following error really difficult.
The complete error looks like this
In the findAnonDefineFactory function from r.js the
call
fromcall = node[1];
is simply undefined when this error appear. So changing the conditionto
makes the error disappear but the resulting js is not working. So this is not a good idea. I reverted this change and then modified the function where this get called. If I change the parse.getAnonDeps function like this:
The error shown become a little bit interesting.
Should I make a pull request for the last proposed change? Any idea why this error is happening?
The text was updated successfully, but these errors were encountered: