繁体   English   中英

如何配置 tsconfig.json 文件以包含角度库项目的 .ts 文件?

[英]How to configure tsconfig.json file to include .ts files of an angular library project?

我创建了一个 angular 8 库项目! 这是一个带有 bootstrap 4 的简单数据表。现在我面临一些问题。 当我在新项目中通过 npm 安装时,编译失败并出现错误,告诉我某些文件丢失,如下所示:

错误:TypeScript 编译中缺少 /home/atheodosiou/Documents/development/kino-statistics/node_modules/ng-bootstrap-table/src/lib/directives/b-body.directive.ts。 请通过“文件”或“包含”属性确保它在您的 tsconfig 中。

在此处输入图片说明

我的库的 tsconfig.json 文件如下(我读过,如果我没有指定包含属性的文件,编译器将包含所有 .ts 文件):

    {
  "extends": "../../tsconfig.json",
  "compileOnSave": true,
  "compilerOptions": {
    "outDir": "docs/",
    "target": "es2015",
    "declaration": true,
    "inlineSources": true,
    "types": [],
    "lib": [
      "dom",
      "es2018"
    ],
    "noEmitOnError": true
  },
  "angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

我试图通过 include 属性包含所有这些,并通过 files 属性(不是同时)声明它们。

我做错了什么?

先感谢您!

我看到包含的所有文件的方式是

"include": ["**/*.ts"]

我相信您的 exclude 语句仍应排除您请求的文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM