index.ts is missing from the TypeScript compilation
{
"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.
Augie Li
Updated on June 04, 2022Comments
-
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 over 5 yearsIs 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 over 5 yearsIt's not inside compilerOptions, it's at same level
-
Augie Li over 5 yearsI 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 over 5 yearsSee 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 over 5 yearsAfter 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 over 5 yearsBut have you removed the " * * / *.ts " from includes?
-
Augie Li over 5 yearsNo, there was no "include" there. But it works fine if I delete the angular2-indexeddb library.
-
Augie Li over 5 yearsThank 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 over 5 yearsI 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 over 5 yearsThank 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 over 5 yearsI take my last comment back. It is not working if I remove the include
-
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 over 5 yearsThank you. Could you kindly inform me when it is fixed?
-
Charles Assuncao over 5 yearsHi @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