I am attempting to debug a page issue where IE 9 will work the first time on my requirejs/backbone application, but will fail on the page reload. However, when I attempt to debug this problem using the f12 IE developer tools, I cannot navigate to the source to set a breakpoint because IE does not load any of the files that RequireJS includes. How can I get around this issue to fix my IE headache??
I am attempting to debug a page issue where IE 9 will work the first time on my requirejs/backbone application, but will fail on the page reload. However, when I attempt to debug this problem using the f12 IE developer tools, I cannot navigate to the source to set a breakpoint because IE does not load any of the files that RequireJS includes. How can I get around this issue to fix my IE headache??
Share Improve this question asked Feb 21, 2013 at 17:45 Matt BroekhuisMatt Broekhuis 2,0753 gold badges29 silver badges35 bronze badges 2- 2 Does clicking the refresh icon in the HTML tab make a difference? – epascarello Commented Feb 21, 2013 at 17:47
- It does refresh all the script tags that requirejs has written to the dom in the HTML view. However, the script tab does not reflect these new scripts (can't see them) – Matt Broekhuis Commented Feb 22, 2013 at 16:36
3 Answers
Reset to default 4I guess I am late for the party but hope my answer helps you and others as well.
The file that you want to debug or the line in the file, simply add this --> debugger;
before that line.
So, when require.js loads your script and encounter that string i.e. debugger;
exists it will automatically be stopped at that line.
You can generate a single js File with require tools :
- include requirejs in this single file (http://requirejs/docs/optimization.html#onejs)
- set optimise to none (no source minified - http://requirejs/docs/optimization.html#shallow)
In your index.html link this file instead of require.js.
You can debug with IE.
I have the same problem from time to time. What sometimes helps: Close all the files in Debugger view, leave the DevTools open, press Play to allow page to continue and then make your action on the page or reload - if it halts on the debugger; again, all the files will be loaded. But still investigating ;)