【问题标题】:How to compile typescript files in a specific folder with Angular Quickstart如何使用 Angular 快速入门编译特定文件夹中的打字稿文件
【发布时间】:2016-10-03 18:52:17
【问题描述】:

我使用 Angular Quickstart example 作为我的 Angular 2 应用程序的开始。我目前正在尝试在单独的目录中编译文件,以避免混淆 .ts.js 文件,而我没有办法使用建议的工具来做到这一点。

我想知道在切换到常规 gulp/grunt 编译之前是否有人遇到过问题。

【问题讨论】:

    标签: angular typescript


    【解决方案1】:

    我遇到了同样的问题。在有人提出的这个问题中查看它。 Link to Github issue

    只需在tsconfig.json 中指定目录(outDir),如下所示。

    {
        "version": "1.7.3",
        "compilerOptions": {
            "target": "es5",
            "module": "commonjs",
            "declaration": false,
            "noImplicitAny": true,
            "suppressImplicitAnyIndexErrors": true,
            "removeComments": false,
            "emitDecoratorMetadata": true,
            "experimentalDecorators": true,
            "noEmitOnError": false,
            "preserveConstEnums": true,
            "inlineSources": false,
            "sourceMap": false,
            "outDir": "./dist",
            "rootDir": "./src",
            "project": "./src",
            "moduleResolution": "node",
            "listFiles": false
        },
        "exclude": [
            "node_modules",
            "jspm_packages",
            "typings/browser",
            "typings/browser.d.ts"
        ]
    }

    【讨论】:

    • 感谢您的解决方案!有用。我刚刚添加了关于如何调用我们在此配置中获得的新 JS 文件的精确度。
    猜你喜欢
    • 1970-01-01
    • 2021-03-27
    • 1970-01-01
    • 2020-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-04
    相关资源
    最近更新 更多