【发布时间】:2016-09-26 11:53:11
【问题描述】:
当我保存时,我无法让 Visual Studio 运行 typescript 编译到 js。
我有一个 xproj(带有网络框架的 asp.net 核心) 用于 Visual Studio 2015 更新 3 的 TypeScript 2.0.3 工具。
我尝试在 tsconfig.json 中启用"watch" : true,但它说当前主机不受支持。
我去了工具 > 选项 > 文本编辑器 > TypeScript > 项目并启用“自动编译不属于项目的 TypeScript 文件”
不过,.ts 文件中的更改只会在编译期间反映在 .js 文件中,但只有在必须编译的 c# 服务器端文件发生更改时才会反映。
编辑:我发现即使配置文件为空,项目目录中简单存在的 tsconfig.json 也会阻止编译保存。
目前可以以某种方式修复吗?
这是我的 tsconfig.json 的内容:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"diagnostics": true
},
"include": [
"**/*.ts"
],
"exclude": [
"node_modules"
]
}
EDIT 2:我也试过了:
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"diagnostics": true
},
"filesGlob": [
"**/*.ts"
],
"exclude": [
"node_modules"
]
}
它什么也没做。
【问题讨论】:
-
我也有同样的问题。此外,自安装 Update 3 和 Typescript 2.0.3 以来,智能感知不再工作。有人有解决办法吗?