【问题标题】:Multiple tsconfig on a Visual Studio 2015 Project [typescript 1.8]Visual Studio 2015 项目中的多个 tsconfig [typescript 1.8]
【发布时间】:2016-08-11 14:15:09
【问题描述】:

我有一个使用打字稿的 MVC 5 项目。 现在我必须实现新功能,我打开其他打字稿实现方式。 我正在尝试使用 typescript 1.8 的多个 tsconfig.json 文件新功能,我有两个文件夹:typescriptE21typescript,每个文件夹上都有一个 tsconfig.json 文件。

第一个:

{
    "compilerOptions": {
        "removeComments": false,
        "sourceMap": false,
        "target": "es5",
        "noImplicitAny": false,
        "module": "amd",
        "declaration": false,
        "noEmitOnError": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "inlineSourceMap": true,
        "inlineSources": true
    },
    "compileOnSave": true,
    "exclude": [
        "node_modules",
        "typescript"
    ]
}

第二个:

{
    "compilerOptions": {
        "removeComments": false,
        "sourceMap": false,
        "target": "es5",
        "noImplicitAny": false,
        "module": "system",
        "declaration": false,
        "noEmitOnError": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "inlineSourceMap": true,
        "inlineSources": true
    },
    "compileOnSave": true,
    "exclude": [
        "node_modules",
        "typescript21",
        "scripts"
    ]
}

当我在 Typescript 部分打开项目属性时,显示“检测到一个或多个 tsconfig.json 文件。项目属性已禁用。”这是正确的,但是当我运行应用程序时出现此错误:

Build: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning

关于这个文件:

import {Component} from "ngts/ngts";

@Component({
    template: `<div md-scroll-y flex class="md-padding" id="contenido">Contenido</div>`
})
export class EmAplicacion {

}

在两个tsconfig.json 文件中,我都激活了装饰器,但打字稿似乎没有从那里获得编译器选项...

此外,当我不使用装饰器时,它可以编译,但我可以看到结果文件,并且当我将“系统”放入第二个配置文件时,它们是使用 AMD 模块系统发出的......

有什么问题?

【问题讨论】:

    标签: typescript typescript1.8


    【解决方案1】:

    真正的问题是tsconfig.json 文件包含在项目中:

    <None Include="typescript\tsconfig.json" />
    

    我已经改了;

    <Content Include="typescript\tsconfig.json" />
    

    一切都好

    【讨论】:

    • 你在哪里做这个?什么文件?
    • 我在 .csproj 文件上做。
    【解决方案2】:

    这也会有所帮助:

    1. 打开解决方案资源管理器
    2. 右键单击 tsconfig.json 文件并选择“从项目中排除”。
    3. 您可能会看到 tsconfig.json 从解决方案资源管理器中消失。在这种情况下,从顶部选择“显示所有文件”选项 解决方案资源管理器工具栏的。
    4. 右键单击 tsconfig.json 并选择“包含在项目中”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-05
      • 2017-03-19
      • 1970-01-01
      相关资源
      最近更新 更多