【问题标题】:angular2 seed Typescript transpile settings (output)angular2 种子 Typescript 转译设置(输出)
【发布时间】:2016-03-20 05:49:16
【问题描述】:

我已经开始使用 mgechev 的 Angular2 Seed,我有一个关于 Typescript 转译器的简单问题。

目前“src”文件夹中的所有内容都将被转译到“dist”文件夹中。但是同时所有的.ts文件也在自己的文件夹中被转译成.js和.js.map,这样整个文件夹就有点乱了。

我的问题:如何禁用此行为?我希望 .ts 文件只转译一次到 dist 文件夹中。下面是我在 tsconfig.json 中的当前设置

非常感谢,干杯!

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "pretty": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitUseStrict": false,
    "noFallthroughCasesInSwitch": true
  },
  "exclude": [
    "node_modules",
    "typings/browser.d.ts",
    "typings/browser/**"
  ],
  "compileOnSave": false
}

【问题讨论】:

  • 查看this 问题以更改编译文件的输出目录。

标签: typescript angular angular-seed transpiler


【解决方案1】:

您可以在您的 tsconfig.json 文件中使用 outDir 属性和 dist 值:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "pretty": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitUseStrict": false,
    "noFallthroughCasesInSwitch": true,
    "outDir": "dist" // <-------
  },
  "exclude": [
    "node_modules",
    "typings/browser.d.ts",
    "typings/browser/**"
  ],
  "compileOnSave": false
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 2017-05-20
    • 2016-06-17
    • 2021-03-03
    • 1970-01-01
    • 1970-01-01
    • 2017-10-29
    相关资源
    最近更新 更多