Over a million developers have joined DZone.

Debugging TypeScript Under DotNetNuke

· Web Dev Zone

Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.

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




The Web Dev Zone is brought to you by Stormpath—offering a complete, pre-built User Management API for building web and mobile applications, and APIs. Download our new whitepaper: "Build Versus Buy: Customer Identity Management for Web and Mobile Applications".

Topics:

Published at DZone with permission of Dave Bush , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}