Подтвердить что ты не робот

Angular5: polyfills.ts &\main.ts отсутствует в компиляции TypeScript

Это моя структура проекта Angular5.

enter image description here

Оба tsconfig.app.json и package.json содержат этот раздел

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

Но что бы я ни пытался, я все равно получаю эту ошибку:

    \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 У кого-нибудь есть идеи, чего здесь не хватает?

  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"
  ]
}
4b9b3361

Ответ 1

Нашел решение. Проблема в том, что я был в каталоге символических ссылок ($ HOME/dev → d:\dev \) Перейдите в исходный каталог (d:\dev) и запустите ваши команды, и это работает.

Источник: https://github.com/angular/angular-cli/issues/9909

Ответ 2

Возможно, потому, что вы используете абсолютный путь.

Попробуйте изменить:

"/src/main.ts",

в

"src/main.ts",

(Или, возможно, просто "main.ts")

Ответ 3

Предложение, сделанное ответом @Sara на @LFelix, сработало для меня.

Редактирование angular.json для добавления следующего атрибута под узлом "projects/{yourprojectname}/architect/build/options" должно помочь: "preserveSymlinks": true