【问题标题】:exclude files from angular 4 build从 Angular 4 构建中排除文件
【发布时间】:2019-01-29 16:36:24
【问题描述】:

如何确认在构建后排除文件?

我的 tsconfig.json 文件是这样的

 {
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "exclude": [
    "src/app/schemas/abc"
  ]
}

【问题讨论】:

  • 你在使用 angular-cli 吗?
  • 是的。我正在使用 angular-cli。
  • 您能否详细说明问题所在并发布您的配置文件?请发布您的 tsconfig.app.json
  • 请看一下。我已经更新了我的问题。

标签: angular typescript angular-cli


【解决方案1】:

这取决于项目中 tsconfig 文件的位置。如果您的 tsconfig 文件在 src/tsconfig 中,那么您在编译器选项中缺少 baseUrl,您应该包含这样的路径。

{
  "compilerOptions": { 
   "baseUrl": ".",
   ....
 },
  "exclude": [
    "schemas/abc",
    "./app/schemas/abc/"
  ]
}

这将在您编译时排除 schemas/abc/ 中的所有文件。

【讨论】:

    猜你喜欢
    • 2017-12-10
    • 1970-01-01
    • 1970-01-01
    • 2014-07-23
    • 2014-10-05
    • 2018-09-22
    • 2017-07-13
    • 2017-02-13
    相关资源
    最近更新 更多