这是我的Angular5项目结构。
angular - TypeScript编译中缺少Angular5:polyfills.ts和\main.ts-LMLPHP
tsconfig.app.jsonpackage.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.

angular - TypeScript编译中缺少Angular5:polyfills.ts和\main.ts-LMLPHP
有人知道这里少了什么吗?
  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"
  ]
}

最佳答案

找到了解决办法。问题是因为我在一个符号链接目录($home/dev->d:\ dev\)
移动到原始目录(d:\ dev)并运行您的命令,它就会工作。
资料来源:https://github.com/angular/angular-cli/issues/9909

关于angular - TypeScript编译中缺少Angular5:polyfills.ts和\main.ts,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49091956/

10-10 02:53