Solvedangular cli Error on file "is missing from the TypeScript compilation" when invoking ng build or ng serve

I have the following folder/file structure on a sample angular5 application created using angular-cli:

| tsconfig.json
| src
| | main.ts
| |
| | app
| | | app.module.ts
| | model
| | | index.ts
| | | person.ts
| | services
| | | index.ts
| | | restclient.service.ts

When trying to do a "ng build" or "ng serve" I'm getting the below error:

ERROR in ./app/model/person.ts Module build failed: Error:
C:\Repos\ngsample\src\app\model\person.ts is missing from the
TypeScript compilation. Please make sure it is in your tsconfig via
the 'files' or 'include' pproperty.
at AngularCompilerPlugin.getCompiledFile (C:\Repos\ngsample\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:662:23)
at plugin.done.then (C:\Repos\ngsample\node_modules@ngtools\webpack\src\loader.js:467:39)
@ ./app/model/index.ts 2:0-28 @ ./app/services/restclient.service.ts
@ ./app/services/index.ts @ ./app/app.module.ts @ ./main.ts @ multi

Already found a bunch of articles suggesting to do "ng serve --preserve-symlinks" or to modify the "tsconfig.json" and/or "" to include all the .ts files found under src/app folder. None of the approaches I found on my research seems to work.

Also made sure I don't have a typo and I'm sure that is not the problem right now.

BTW, the index.ts files under "model" and "services" are just exporting all the classes under those folders, such as:

 // model/index.ts
 export * from "./person"
 // services/index.ts
 export * from "./restclient.service"

Any ideas of other approaches that I can test to see if I can compile the application correctly?

Versions used:

// packages.json
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/cli": "1.6.7",
"typescript": "^2.6.0"

// node -v

// ng -v
@angular/cli: 1.6.7
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.7
@schematics/angular: 0.1.17
typescript: 2.6.2
webpack: 3.10.0
17 Answers

✔️Accepted Answer

It was also an issue with an import written has ./Store instead of ./store

Other Answers:

To add my experience, I had an error like this but it ended up being an issue of case sensitivity.

On my machine, it showed a folder as models but on our CI build machine it had the folder as Models

As a result, one of the .ts files showed up on the build server as not being included in Typescript compilation but on all other machines that I tested it on, it worked just fine.

Apparently my git config settings were set to ignore case. I spent 6 hours debugging this issue, so hopefully I can save a few people some time.

I have this issue....this issue sucks :(

this is how I solved it for local development:

Just for some helpful input, if you create a symlink on windows (mklink /D) and try to compile from the path that link points to, you also see this issue.
Putting a note here for future googlers

More Issues: