Upgrading Angular 8 to Angular 9 Error: .ts is missing from the TypeScript compilation

Viewed 3385

I recently upgraded out Angular 8 application, to Angular 9, using the following commands:

ng update @angular/core@8 @angular/cli@8
ng update @angular/core @angular/cli

The only package that manually needed changes, was ngx-store to ngx-store-9, which I did with the following commands:

npm uninstall ngx-store
npm install ngx-store-9

I then went ahead and changed all of the import statements for ngx-store to ngx-store-9.

I am now receiving the following error when I build my app:

ERROR in ./src/app/models/companySearchCriteria.ts Module build failed (from ./node_modules/@ngtools/webpack/src/index.js): Error: D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\src\app\models\companySearchCriteria.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. at AngularCompilerPlugin.getCompiledFile (D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:933:23) at D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\node_modules@ngtools\webpack\src\loader.js:41:31 at processTicksAndRejections (internal/process/task_queues.js:93:5)

Below, is my tsconfig.app.json file:

      "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": []
  },
  "files": [
    "main.ts",
    "polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

I am not quite sure why this is happening. Any help would be appreciated.

2 Answers

In my case, for some reason, the file name in the import statements were capatilized.

For instance, let's say I had the following .ts file: companySearchModel.ts

export class CompanySearchModel {
    //some properties
}

The import statement in another file, where the companySearchModel is used, looked like this:

import { CompanySearchModel } from './models/CompanySearchModel.ts'

When it should have looked, like this:

import { CompanySearchModel } from './models/companySearchModel.ts'

Not sure why this happened, but after changing the file's name in the import statement to reflect the real name of the file (lower case), it worked.

In my case i only close the compiler and started again.

The problem was resolved.

Hope it works

Related