10

Description of the project: My project is downloading to node_module via package.json

Package.json

....
   dependencies:{
       ....
       "@myllc/application-core": "git+ssh://[email protected]/myllc/application-core.git",
       "@myllc/application-shared":"git+ssh://[email protected]/myllc/application-shared.git",

   }
   ....

Gotting error when doing "npm build":

ERROR in ./node_modules/@myllc/application-core/index.ts Module build failed: Error: /var/www/frontend-skeleton/node_modules/@myllc/application-core/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 Form at (https:// docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview).

This appear after upgrade 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 there appear same error at deeper folder .ts file. Also founding https://github.com/angular/angular-cli/issues/8284 but nothing solved this error.

What is the solution?

2
  • 1
    I have the same issue, looks like references are broken. Can't find anything on google. Commented Mar 13, 2018 at 19:39
  • Can I see your package.json file? Commented Mar 19, 2018 at 11:54

1 Answer 1

3

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

2 tsconfig.json files, one at the root of the app, and the other inside the src folder (one level down from the root) named tsconfig.app.json that extends the main tsconfig.json. I explicitly added the package that I needed that wasn't being transpiled by Typescript in the "include" array, and like a lot of people here I was getting the *.spec.ts files included despite having them in "exclude" option, so I removed it from the tsconfig.json. The fix was adding 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"
]
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.