Reputation: 4259
We're doing some much-needed refactoring, and as a result, a lot of errors.
In RequireJS, when a module is not found, or it gets a 404 error, it says:
GET http://localhost/resources/wrong/path/main.js 404 (Not Found) require.js:1895
Uncaught Error: Script error for: main
http://requirejs.org/docs/errors.html#scripterror
How can I see which model is doing the require call for main
aside from painstakingly searching through the entire codebase?
Upvotes: 3
Views: 187
Reputation: 21
If you don't mind doing a little hack with the requirejs source code (provided you are not using the minified version). You can replace line 1696 with the following lines
var rel = registry ? registry[data.id] : undefined;
var pmap = rel ? (rel.map ? rel.map.parentMap : undefined) : undefined;
var purl = pmap ? pmap.url : "?";
var errorMsg = 'Script error while loading '+ data.id + ' from ' + purl;
return onError(makeError('scripterror', errorMsg, evt, [data.id]));
I am not recommending the above as a solution, but it has been useful to me, and might be useful for someone else too.
Upvotes: 1