index.ts is missing from the TypeScript compilation

11,757
{
    "include": [
          "../src/**/*",
          "../node_modules/angular2-indexeddb/index.ts"
    ]
}

EDIT: I do recommend you change your lib to ngx-indexed-db, so you don't need to do this.

Share:
11,757
Augie Li
Author by

Augie Li

Updated on June 04, 2022

Comments

  • Augie Li
    Augie Li almost 2 years

    I got following error when running 'ng serve'.

    node_modules/angular2-indexeddb/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview).

    I guess the issue is that angular2-indexeddb is not taken into compilation by tsconfig. https://github.com/gilf/angular2-indexeddb

    I think there should be a temporary work around by editting the following configuration in tslint.json, but I need a solution to work through it.

      "include": [
        "**/*.spec.ts",
        "**/*.d.ts"
      ] 
    

    Is it because angular2-indexeddb doesn't provide a good packaged library? In fact, I don't think a popular published library should have this issue. Or I missed something for configuration or compilation? Can I use package compilation tools/library to compile it into d.ts or spec.ts?

    update:

    In fact, I see *.d.ts file in the directory:

    ls node_modules/angular2-indexeddb/
    LICENSE                                 angular2-indexeddb.metadata.json        index.js
    README.md                               angular2-indexeddb.min.js               index.js.map
    angular2-indexeddb.d.ts                 angular2-indexeddb.min.js.map           index.ts
    angular2-indexeddb.js                   angular2-indexeddb.ts                   package.json
    angular2-indexeddb.js.map               index.d.ts
    

    Content in 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"
        ]
      }
    }
    
  • Augie Li
    Augie Li over 5 years
    Is it in the file tsconfig.json under "compilerOptions"? I get the following error: tsconfig.json(18,5): error TS5023: Unknown compiler option 'exclude'.
  • Charles Assuncao
    Charles Assuncao over 5 years
    It's not inside compilerOptions, it's at same level
  • Augie Li
    Augie Li over 5 years
    I am still seeing the same issue after I add exclude node_modules, I guess it is because I didn't add the files and include. What is the standard tsconfig.json look like? I didn't ever change the tsconfig.json, and it is all okay for other libraries.
  • Charles Assuncao
    Charles Assuncao over 5 years
    See now edited, try to include that. And if you are using the new CLI version you have to edit it in you tsconfig.app.json
  • Augie Li
    Augie Li over 5 years
    After adding it, I got new error: <project-root>/src/main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
  • Charles Assuncao
    Charles Assuncao over 5 years
    But have you removed the " * * / *.ts " from includes?
  • Augie Li
    Augie Li over 5 years
    No, there was no "include" there. But it works fine if I delete the angular2-indexeddb library.
  • Augie Li
    Augie Li over 5 years
    Thank you, it is working now !! But I am still quite curious why I had no "include" there before I added indexeddb library, why it was working all the time?
  • Charles Assuncao
    Charles Assuncao over 5 years
    I think it's a problem with the lib, you can see that if you delete the .ts files inside the node_modules/angular2-indexeddb/ will also works, but it's more verbose :). Good that is working now :)
  • Augie Li
    Augie Li over 5 years
    Thank you. After it is working once, even I revert the tsconfig.app and tsconfig.app.json as it was, (no include), it is still working. Is it because something didn't compiled?
  • Augie Li
    Augie Li over 5 years
    I take my last comment back. It is not working if I remove the include
  • Charles Assuncao
    Charles Assuncao over 5 years
    @AuggieLi If you remove the includes but go to the node_modules/angular2-indexeddb folder and delete the index.ts and angular2-indexeddb.ts it will work, it's a problem with the lib, I will try to open a PR fixing this for them :)
  • Augie Li
    Augie Li over 5 years
    Thank you. Could you kindly inform me when it is fixed?
  • Charles Assuncao
    Charles Assuncao over 5 years
    Hi @AuggieLi I several improvements on the lib and now you don't need that configuration to includes in the ts config anymore, you can replace your ng2-indexeddb for this new version: npmjs.com/package/ngx-indexed-db