Angular5 :polyfills.ts &TypeScript 编译中缺少 \main.ts [英] Angular5 :polyfills.ts & \main.ts is missing from the TypeScript compilation
本文介绍了Angular5 :polyfills.ts &TypeScript 编译中缺少 \main.ts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的 Angular5 项目结构.
This is my Angular5 project structure.
tsconfig.app.json
和 package.json
都包含这个部分
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.
有人知道这里缺少什么吗?
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"
]
}
推荐答案
找到了解决方案.问题是因为我在一个符号链接目录 ($HOME/dev -> d:\dev\ )移动到原始目录 (d:\dev) 并运行您的命令,它可以工作.
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.
来源:https://github.com/angular/angular-cli/issues/9909
这篇关于Angular5 :polyfills.ts &TypeScript 编译中缺少 \main.ts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文