最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Debug TypeScript in Chrome, 404 response - Stack Overflow

programmeradmin1浏览0评论

I'm piling my .TS to JavaScript and generating source maps. However, I can't debug the actual files. I have an X number of .TS files that piles into CombinedTypescript.js with a source map that is correct.

However, when I try to access my .TS files in the Chrome Debugger, it just gives me a 404 response. The files exist in "Sources", but I can't access them or set breakpoints in CombinedTypescript.js and step through my files.

Does anyone have an idea of what the problem might be?

I'm piling my .TS to JavaScript and generating source maps. However, I can't debug the actual files. I have an X number of .TS files that piles into CombinedTypescript.js with a source map that is correct.

However, when I try to access my .TS files in the Chrome Debugger, it just gives me a 404 response. The files exist in "Sources", but I can't access them or set breakpoints in CombinedTypescript.js and step through my files.

Does anyone have an idea of what the problem might be?

Share Improve this question asked Feb 4, 2015 at 12:24 Emil LarssonEmil Larsson 2264 silver badges15 bronze badges 4
  • 2 Are you using IIS? You probably have to add .ts as an mime type (or this) – David Sherret Commented Feb 4, 2015 at 14:59
  • 1 @DavidSherret I would post that as the answer – basarat Commented Feb 4, 2015 at 23:00
  • @basarat I didn't want to answer with the assumption they were using IIS, but yeah that's most likely the issue. – David Sherret Commented Feb 4, 2015 at 23:58
  • Thank you! Yep, it was the missing Mime type, what a simple fix. – Emil Larsson Commented Feb 6, 2015 at 8:31
Add a ment  | 

1 Answer 1

Reset to default 8

The issue you are having is most likely that IIS isn't configured to serve .ts files. You'll need to add .ts as an MIME type.

Option 1 - Edit web.config

I'd suggest doing this change so that your project will serve .ts files regardless of the environment. To do this, add an mimeMap tag to your web.config under configuration > system.webServer > staticContent like so:

<configuration>
    ...
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".ts" mimeType="application/x-typescript" />
        </staticContent>
    </system.webServer>
</configuration>

Source

Option 2 - Configure IIS

Another option is to configure IIS to serve .ts files. Here are some resources for doing that:

  • How to add an MIME type to a web site (IIS 8)
  • Add MIME Type (IIS 7)
  • Configure MIME Types (IIS 6)
发布评论

评论列表(0)

  1. 暂无评论