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
[Error: TypeError: Cannot call method 'substring' of undefined at modLine #924
Comments
It is hard to know by just looking what state of the code would have caused this. If there is a test case that can be run to reproduce the issue, that would help. |
HI, i solved it but, removing each extension of my project and add one by one to find the one with error...
It is common to happen? |
Comments should be fine. I expect the issue is with some hidden character in the file, that may mess up the parsing. If you have a copy of the file in question that you could attach to the issue, I can run some tests locally to see how it fails. |
Hey @jrburke, I also faced the same issue.Removing the comments fixed the issue. |
Thank you for the test file. There is a fix in master for this, you can try the latest master snapshot to verify that it works for you: https://raw.githubusercontent.com/requirejs/r.js/master/dist/r.js |
Hey jrburke, Thanks for the fix. I have tried with latest snapshot and the files are getting optimized into a single file.
is getting optimized as an anonymous module and the module path is getting randomly inserted inside the code:
When I remove and add the Attaching the file with comment thats causing issues.. |
I was trying to avoid doing work for this case, but I think I need to do some more work upfront, will reopen for examining a further fix, but it may not come until the weekend. The core of the issue is the file containing just \r and not \r\n (or just \n if a unixy system). How are these files generated, why just the \r characters? |
The contentNController.js.txt file seems to have a mix of line endings: one with a \r\n, and the rest of the lines are \r. This is makes it difficult to determine how to parse on linebreaks. This seems to be a malformed file, and a file with just \r's in them also seems odd. This seems to break at least my expectations of windows using CRLF and unixy systems using just LF. I'm going to reset the change I did, I need to understand more how these kinds of files are generated, and if it is better to get the problem fixed in whatever editor or process that is generating these files without the expected CRLF line returns. If anyone has details on this, feel free to add a comment here. |
I ran grunt at my project i got the error:
So i went and checked the line it is:
contentLines[lineIndex] = line.substring(0, startIndex) + contentInsertion + line.substring(startIndex, line.length);
inside the function
modLine
I search but i didn't found any releated error.
:/
The text was updated successfully, but these errors were encountered: