簡體   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