当我保存时,我无法使 Visual Studio 将打字稿编译为 js。
我有一个xproj(带有net框架的asp.net core)
适用于 Visual studio 2015 更新 3 的 TypeScript 2.0.3 工具。
我已尝试启用"watch" : true
在 tsconfig.json 中,但它表示不支持当前主机。
我转到“工具”>“选项”>“文本编辑器”>“TypeScript”>“项目”并启用“自动编译不属于项目的 TypeScript 文件”
尽管如此,.ts 文件中的更改仅在编译期间才会反映在 .js 文件中,但仅当必须编译的 c# 服务器端文件发生更改时才会反映。
EDIT:我发现,即使配置文件为空,项目目录中简单存在 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"
]
}
但它没有做任何事情。