gpt4 book ai didi

TypeScript 编译中缺少 Angular5 :polyfills. ts &\main.ts

转载 作者:太空狗 更新时间:2023-10-29 16:58:44 27 4
gpt4 key购买 nike

这是我的 Angular5 项目结构。

enter image description here

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.

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

最佳答案

找到解决方案。问题是因为我在符号链接(symbolic link)目录中($HOME/dev -> d:\dev\)移至原始目录 (d:\dev) 并运行您的命令,一切正常。

来源:https://github.com/angular/angular-cli/issues/9909

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com