Debugging typescript in SPA

Topics: General
Mar 21, 2013 at 2:32 PM
I have an app that has typescript files loaded both at a primary SPA web page as well as others that are loaded as partial pages via ajax calls.

It seems that VS2012 debugging works well for any source loaded via the initial page, but not at all for source loaded at runtime via ajax.

Is there a method to enable this or is this just not possible in VS?
Mar 22, 2013 at 3:22 PM
This may not work in VS, with the current version.

Does the JavaScript you're loading via AJAX also contain the sourceMappingURL at the bottom? If it's missing, we can't discover the source map. If it's there, it may just be that the AJAX scenario just isn't well-supported, yet.
Mar 25, 2013 at 6:53 PM
Yes, the sourceMappingURL is included at the bottom.

I have subsequently discovered that the debugging will work if I load the script dynamically using requirejs instead of just loading the script using <script> tag. I would suspect this is because the script was not being loaded in the root DOM.
Mar 26, 2013 at 2:03 PM
That's handy to know, thanks for sharing. With luck, people who have the same issue will find this thread in the future.