Closed kingnight closed 10 years ago
@kingnight can you give more information? Have you been able to isolate the problem at all?
1) I find if at the beginning of the javascript ,add some comments, after r.js optimizer , the result js file will partly not auto id in define
2) https://groups.google.com/forum/#!topic/requirejs/klf1OMS3zA8
Actually the problem is in r.js optimizer. In my case, one of the files was saved using old Mac OS line endings (\r). And other files were saved using Windows line endings (\r\n).
r.js doesn't detect correct line endings for such case, and following line simply doesn't split the file by lines: contentLines = contents.split('\n');
So I've changed this line in the file r.js to following: contentLines = contents.split(/(\r\n|\r|\n)/g);
And after this everything worked fine for me. Or you can simply check and fix all your .js files for correct line endings - \n or \r\n
Cool @kingnight. Glad you figured it out! I'm going to close this for now. You might consider raising an issue over on r.js about this if you think the behavior of the optimizer could be improved.
{ [Error: TypeError: Cannot call method 'substring' of undefined at modLine (/Users/aisino/Documents/yjyImsCenter/www/node_modules/grunt-contrib-requirejs/node_modules/requirejs/bin/r.js:23950:48) ] originalError: [TypeError: Cannot call method 'substring' of undefined] }
node version 0.10.29 install by grunt 0.4.4