HTML5 Zone is brought to you in partnership with:

Dave Bush is a .NET programmer and Certified ScrumMaster who is passionate about managing risk as it relates to developing software. When he is not writing or speaking about topics related to Application Lifecycle Risk Management (ALRM), he is an example to his peers as he develops web sites in the ASP.NET environment using industry best practices. Specific topics Dave can address include: • Project management, with an emphasis on Scrum • Test Driven Development (TDD) • Behavioral Driven Development (BDD) • Unit testing and Integration testing using NUnit, Jasmine and SpecFlow • Web Application testing using Selenium • Continuous Integration • Extreme programming (XP) • Coding best practices • Architecture • Code Reviews Dave has "an insatiable curiosity and is always learning." He has been called "the miracle worker" and "hard to replace" by clients he has worked for recently. Contact Dave via LinkedIn (http://www.linkedin.com/in/davembush/) to find out more about how he can help your organization reduce software development risk Dave is a DZone MVB and is not an employee of DZone and has posted 52 posts at DZone. You can read more from them at their website. View Full User Profile

Debugging TypeScript Under DotNetNuke

05.10.2013
| 2210 views |
  • submit to reddit

I’ve been playing with TypeScript for the last couple of weeks and I’ve fallen in love.  Now I can write JavaScript code without having to switch between thinking about the problem in terms of object oriented programming (csharp) and kind of sort of object oriented programming (javascript).

But, what I’ve had trouble getting to work is using the sourcemap feature to debug in TypeScript instead of debugging in the resulting JavaScript.  Not that I can’t read the resulting JavaScript, I can.  But, I invariably end up changing the JS source instead of the TS source.

I also had the added wrinkle that all of my development lately is for DotNetNuke, which has the ClientDependency module wired into it.  Since the map file that gets created knows nothing about this, we have to disable ClientDependency.  Easy, you say, just take it out of the web.config file.  Oh that it were that easy.

You see, like I said, it is WIRED into DotNetNuke.  But all we really need to do is turn off the combining in host settings and then write a URL Rewrite rule in IIS that has the following search and replace.  (I’m assuming by now you know about the IIS7 Rewrite module.)

Regex Search rule: (.+)\?cdv=\d+
Replace: {R:1}

This will make DotNetNuke go after the original source files instead of adding the CDV=versionNumber stuff at the end of the filename.

The second thing you will probably need to do is to add a mimetype for the.ts extension.  At least I had to.  If you don’t do this, than IIS won’t know that it is safe to serve the ts file.  So, once again, in IIS, go to your mime types setting and add a mime type for .ts as text/javascript (OK, it isn’t really javascript but it is close enough).

Hope this saves someone a few hours of searching.

Other places talking about typescript debugging:

Links to related resources




Published at DZone with permission of Dave Bush, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)