Ban*_*San 6 visual-studio typescript visual-studio-2015 asp.net-core
我有一个Visual Studio项目,其结构如下:
我tsconfig.json看起来像:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"outDir": "../wwwroot/"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
Run Code Online (Sandbox Code Playgroud)
但是,VS没有编译app.ts到wwwroot文件夹中.
我错过了什么?
eri*_*den 10
尝试添加"compileOnSave": true到您的tsconfig.json:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"outDir": "../wwwroot/"
},
"exclude": [
"node_modules",
"wwwroot"
],
"compileOnSave": true
}
Run Code Online (Sandbox Code Playgroud)
它应该在你每次保存时编译.
从Visual Studio的项目>属性>构建中,>确保选中“在构建时编译TypeScript”:
另外,tsconfig.json您还应在其中指定一个,rootDir以便TypeScript知道在哪里查找*.ts应编译的文件:
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"outDir": "../wwwroot/",
"rootDir": "../wwwroot/"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
Run Code Online (Sandbox Code Playgroud)
不要忘记实际构建它。这不是文件监视程序。
| 归档时间: |
|
| 查看次数: |
10877 次 |
| 最近记录: |