简体   繁体   中英

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

I have created an angular 8 library project! It is a simple data table with bootstrap 4. Now I am facing some problems. 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:

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. Please make sure it is in your tsconfig via the 'files' or 'include' property.

在此处输入图片说明

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):

    {
  "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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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