简体   繁体   English

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

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

I have created an angular 8 library project!我创建了一个 angular 8 库项目! It is a simple data table with bootstrap 4. Now I am facing some problems.这是一个带有 bootstrap 4 的简单数据表。现在我面临一些问题。 When I install in via npm in a new project, compile fails with the an error which told me that some files are missing like bellow:当我在新项目中通过 npm 安装时,编译失败并出现错误,告诉我某些文件丢失,如下所示:

Error: /home/atheodosiou/Documents/development/kino-statistics/node_modules/ng-bootstrap-table/src/lib/directives/b-body.directive.ts is missing from the TypeScript compilation.错误:TypeScript 编译中缺少 /home/atheodosiou/Documents/development/kino-statistics/node_modules/ng-bootstrap-table/src/lib/directives/b-body.directive.ts。 Please make sure it is in your tsconfig via the 'files' or 'include' property.请通过“文件”或“包含”属性确保它在您的 tsconfig 中。

在此处输入图片说明

My library's tsconfig.json file is the following (I have read that if I am not specify the files of include properties, compiler would include all .ts files):我的库的 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"
  ]
}

I have tried to include all of them via the include property and also to declare them via the files property (not at the same time).我试图通过 include 属性包含所有这些,并通过 files 属性(不是同时)声明它们。

What I am doing wrong?我做错了什么?

Thank you in advance!先感谢您!

The way I've seen all files included is to have我看到包含的所有文件的方式是

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

I believe that your exclude statement should still exclude the files you requested.我相信您的 exclude 语句仍应排除您请求的文件。

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

相关问题 如何在angular2项目中创建tsconfig.json文件? - How to create tsconfig.json file in angular2 project? 如何在 tsconfig.json 中排除以“.spec.ts”结尾的文件 - How to exclude files ending in '.spec.ts' in tsconfig.json 如何在tsconfig.json文件中为外部库配置路径属性 - How to configure paths property in tsconfig.json file for external libraries 如何在 prod 构建中包含 tsconfig.json? - How to include tsconfig.json in prod build? app.component.ts不在tsconfig.json定义的项目中 - app.component.ts is not in project defined by tsconfig.json tsconfig.json 包含属性 - tsconfig.json include property Angular/Typescript tsconfig.json 配置多个路径的路径别名 - Angular/Typescript tsconfig.json configure path alias with multiple paths 在配置文件“ tsconfig.json”中找不到输入。 指定的“包含”路径在Angular 6中 - No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were in Angular 6 将 Angular 10 项目转换为 nativescript 共享项目时出现“无法解析 tsconfig.json 文件”错误 - “Can't parse tsconfig.json file” error when converting Angular 10 project to nativescript shared project Angular 中 tsconfig.json 文件中的 lib 数组中的 dom 是什么? - What is dom for in the lib array in the tsconfig.json file in Angular?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM