Visual studio Angular 2.ts文件在Visual Studio 2015 ASP.NET核心项目中保存时未转换为.js
如果我对app.component.ts进行更改并保存该文件,则在手动构建项目之前,更改不会显示在app.component.js中 我的目标是在保存后在浏览器中反映Angular 2代码更改。我不应该每次都做一个构建 这是我的tsconfig.json:Visual studio Angular 2.ts文件在Visual Studio 2015 ASP.NET核心项目中保存时未转换为.js,visual-studio,typescript,angular,asp.net-core,Visual Studio,Typescript,Angular,Asp.net Core,如果我对app.component.ts进行更改并保存该文件,则在手动构建项目之前,更改不会显示在app.component.js中 我的目标是在保存后在浏览器中反映Angular 2代码更改。我不应该每次都做一个构建 这是我的tsconfig.json: { "compilerOptions": { "target": "es5", "module": "system", "moduleResolution": "node", "sourceMap": tr
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
您缺少“compileOnSave”:true
。声明说它只适用于VisualStudio2015和Atom TypeScript插件。它还需要TypeScript 1.8.4或更高版本
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
在任务运行器资源管理器上
转到自定义并运行
tsc:w
此操作有效!其他教程都没有提到compileOnSave。我想这可能是Visual Studio 2015 Update 2中的一个bug?对我来说,它是在保存时编译的,直到我添加了一个tsconfig.json文件。然后它停止工作,直到我添加了compileOnSave。对我来说,它仍然不起作用。我已经在这里发布了我的项目,有人能帮我吗