Module build error: Error: index.ts is missing from TypeScript compilation

Project Description: My project is loaded in node_module via package.json

Package.json

.... dependencies:{ .... "@myllc/application-core": "git+ssh:// git@bitbucket.org /myllc/application-core.git", "@myllc/application-shared":"git+ssh:// git@bitbucket.org /myllc/application-shared.git", } .... 

Error executing npm build command:

A mistake in. / node_modules/@myllc/application-core/index.ts Module Build error: Error: / var / www / frontend -skeleton/node_modules/@myllc/application-core/index.ts is missing from the TypeScript compilation. Please make sure that 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 poorly packaged library. Please open in the library repository to warn its author and ask them to pack the library using the Angular Package form ( https:// goo.gl/jB3GVv ).

Will appear after upgrading from Angular4 to Angular5: TSconfig:

 { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "baseUrl": "src", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "lib": [ "es2016", "dom" ], "typeRoots": [ "node_modules/@types" ] } } 

I tried to add

 "include": [ "./node_modules/@myllc/**/*" ] 

but in the deeper folder .ts file the same error appears. Also the founder of https://github.com/angular/angular-cli/issues/8284 but nothing solved this error.

What's the solution?

+6
source share
1 answer

The solution found in index.ts is not part of the compilation. # 8284 from tapaz1 :

2 tsconfig.json files, one of which is located in the root of the application, and the other in the src folder (at the same level as the root) with the name tsconfig.app.json, which extends the main tsconfig.json file. I explicitly added the package I needed, which was not overloaded with Typescript in the include array, and, like many people, I received * .spec.ts files, despite the fact that they were in "exclude", so I removed it from tsconfig .json The fix added the exclude option to the second (extended) tsconfig.app.json file.

tsconfig.app.json:

 { "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../dist", "baseUrl": "./", "module": "es2015", "types": [] }, "exclude": [ "../node_modules/your_package/**/*.spec.ts" ] } 
0
source

Source: https://habr.com/ru/post/1275104/


All Articles