Fil 'src\main.ts' saknas i TypeScript-kompileringen i Angular 18


Jag fick nyligen detta konstiga problem när jag använder kommandot ng serve :

Application bundle generation failed. [1.788 seconds]

X [ERROR] File 'src\main.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

  Ensure the file is part of the TypeScript program via the 'files' or 'include' property.

Men när jag kollar tsconfig.app.json kan jag se att filen main.ts faktiskt är inkluderad :

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

Jag kollade på internet efter en lösning på detta problem men ingen av dem fungerade. Jag använder förresten Angular 18.0.6.

Tack så mycket