Angular5 :polyfills.ts & \main.ts is missing from the TypeScript compilation

Jalle picture Jalle · Mar 4, 2018 · Viewed 11.8k times · Source

This is my Angular5 project structure.

enter image description here

Both tsconfig.app.json and package.json contain this section

 "include": [
      "/src/main.ts",
      "/src/polyfills.ts"
    ]

But no matter what I try I still get this error:

    \polyfills.ts & \main.ts is missing from the TypeScript compilation. 
Please make sure it is in your tsconfig via the 'files' or 'include' property.

enter image description here Anyone has idea what's missing here?

  tsconfig.json
        {
          "compileOnSave": false,
          "compilerOptions": {
            "outDir": "./dist/out-tsc",
            "sourceMap": true,
            "declaration": false,
            "moduleResolution": "node",
            "emitDecoratorMetadata": true,
            "experimentalDecorators": true,
            "target": "es5",
            "typeRoots": [
              "node_modules/@types"
            ],
            "lib": [
              "es2017",
              "dom"
            ]
          }
        }
src/tsconfig.app.json
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "include": [
    "main.ts",
    "polyfills.ts"
  ],
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Answer

LFelix picture LFelix · Aug 21, 2018

Found the solution. The problem is because I was in a symbolic link directory ($HOME/dev -> d:\dev\ ) Move to the original directory (d:\dev) and run your commands and it works.

Source: https://github.com/angular/angular-cli/issues/9909