angular-cli: updating CLI from 6.1.5 -> 7.0.3 indicates missing tsconfig files for ng serve / test (Karma)

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [x] serve
- [x] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node: v9.8.0 npm: 6.4.1 ng: 7.0.3 os: macOS Mojave

Repro steps

In our Angular app we use a library consisting of only .ts files. these are mostly typings (so we should maybe use .d.ts as suffix, but without this compilation worked fine in Angular 6.1.5. After upgrading, for 3 out of 36 .ts files we get errors looking like the one in the log section below.

After including the include property in our tsconfig.json file:

"include" : [
    "node_modules/@customTypings/**/*.ts",
    "src/main.ts",
    "src/polyfills.ts"
  ]

we get the same error for our main.ts and polyfills.ts files. After adding also these files, that fixes compilation for ng serve and ng build. For ng test (with Karma) however, we still get the same errors, even though our tsconfig.spec.json extends tsconfig.json.

Will try to come up with an MWE, WIP

The log given by the failure

ERROR in ./node_modules/@customTypings/api/lib/common.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /Users/michahell/project/node_modules/@customTypings/api/lib/common.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://goo.gl/jB3GVv).
    at AngularCompilerPlugin.getCompiledFile (/Users/michahell/project/node_modules/@ngtools/webpack/src/packages/ngtools/webpack/src/angular_compiler_plugin.ts:1028:15)
    at plugin.done.then (/Users/michahell/project/node_modules/@ngtools/webpack/src/packages/ngtools/webpack/src/loader.ts:49:29)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
 @ ./src/app/components/conversation-message/conversation-message.component.spec.ts 13:15-44
 @ ./src sync \.spec\.ts$
 @ ./src/test.ts

Desired functionality

compilation succeeds as before in 6.1.7

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I just really cannot seem to get this working in our project, really weird. What I’ve done now is add these 3 separate TS files the Angular compiler keeps complaining about in tsconfig.spec.json as follows:

"files": [
    "../node_modules/@zivver/api/lib/common.ts",
    "../node_modules/@zivver/api/lib/contacts.ts",
    "../node_modules/@zivver/api/lib/drafts.ts",
    "test.ts",
    "polyfills.ts"
  ],

because adding the folder to the include property also doesn’t work:

"include": [
    "../node_modules/@zivver/api/lib/*.ts",
]

I still don’t know why this is needed. But at least we can now continue working with Angular 7… 🤷‍♂️