Debugging TypeScript Under DotNetNuke

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

 

Other post in DotNetNuke - Module Development

Like this Article? Subscribe to get every article sent to your email.

Related Post

  • DotNetNuke Modules – Creating Base ModulesDotNetNuke Modules – Creating Base Modules Now that we have DotNetNuke installed into Visual Studio we can go ahead and create our first modules. Actually, creating the modules is pretty simple. But it is even easier to do it […]
  • The case against i, j, and kThe case against i, j, and k One of the greatest programming books of all time is Code Complete by Steve McConnell.  I often recommend this book to new programmers and when I was running the IT department of […]
  • Creating DotNetNuke ModulesCreating DotNetNuke Modules I've decided to start a series on how to create DNN Modules since I have several clients who need to know this information and I don't know of one good place I can send them that has it […]
  • DotNetNuke Modules – Benefits of ArchitectureDotNetNuke Modules – Benefits of Architecture Now that we have something running, it's time to take a look at the various parts of the DotNetNuke framework.  But before we do, we need the all-important question, "Why do we […]
  • DotNetNuke Modules – Install DNN into VS 2008DotNetNuke Modules – Install DNN into VS 2008 Today, we will install DotNetNuke into Visual Studio so that we can create our first module. So fire up Visual Studio, and let's get going. I'll be using Visual Studio 2008 to walk […]

About Dave Bush

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.

One Pingback/Trackback

Awards & Certs


Links