保存 Typescript 文件时,Visual Studio 2015 RC 不创建源映射 [英] Visual Studio 2015 RC does not create sourcemap when saving Typescript file

查看:25
本文介绍了保存 Typescript 文件时,Visual Studio 2015 RC 不创建源映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对打字稿非常陌生,正在最新的 Visual Studio 2015 RC 中试用.

I'm very new to typescript and am trying it out in the latest Visual Studio 2015 RC.

目前,当我保存 ts 文件时,它会自动编译打字稿文件并创建底层 js 文件(当您展开它时,它很好地位于 .ts 文件下方).但是,没有 sourcemap 文件,所以我在调试时从未在 Visual Studio 的 typescript 中打任何断点(无论使用 IE 还是 Chrome canary).

At the moment it compiles the typescript file automatically and creates the underlying js file (nicely underneath the .ts file when you expand it) when I save the ts file. However, there is no sourcemap file, so I never hit any breakpoints in the typescript in visual studio when debugging (regardless of using IE or Chrome canary).

有没有办法启用它,以便在保存时生成源映射文件?通过四处搜索,似乎有很多过去位于 Web 必需品中的编译器选项已经移动或不可用(还没有?):

Is there a way to enable it so it will generate the sourcemap files on save? From searching around it seems a lot of the compiler options that used to be in web essentials that have either moved or are not available (yet?):

推荐答案

如果您要向项目添加新文件,我找到了替代方案,有一个打字稿配置文件选项.因此,如果您添加tsconfig.json",您将获得相同的设置:

I've found an alternative if you go to add a new file to your project, there is a typescript configuration file option. So if you add a 'tsconfig.json' you get the same settings:

{
  "compilerOptions": {
    "module": "amd",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5"
  }
}

我想这更好,因为它可能允许在不同文件夹中为不同的打字稿应用程序进行多种配置.对于我的项目,我只是将它放在根目录中以全局应用.

I guess this is better as it would potentially allow multiple configurations for different typescript apps in different folders. For my project I've just placed it in the root to apply globally.

这篇关于保存 Typescript 文件时,Visual Studio 2015 RC 不创建源映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆