tsc not excluding node_modules

匿名 (未验证) 提交于 2019-12-03 01:10:02

问题:

{   "compilerOptions": {     "target": "es5",     "module": "commonjs",     "moduleResolution": "node",     "sourceMap": true,     "emitDecoratorMetadata": true,     "experimentalDecorators": true,     "removeComments": false,     "noImplicitAny": false   },   "exclude": [     "node_modules",     "typings/main",     "typings/main.d.ts"   ] } 

I'm trying to upgrade an angular2/beta8 app to RC1, and I'm doing so by basically restructuring according to the Quickstart guide.

I copied its tsconfig.json into my project directory. I think I've got everything else ready,but when I run tsc, I get all kinds of errors within files in my node_modules folder. Why is it even looking in there in the first place?

回答1:

I don't know if you found an answer to this Alex but the referred to question/answer in the comments by LDL provides an answer, submitted by Srikanth Injarapu.

Here's the answer just in case someone doesn't feel like going to that link:

If you're targeting ES5, add "node_modules/typescript/lib/lib.es6.d.ts" to tsconfig.json file :

 {        "compilerOptions": {      "module": "commonjs",      "target": "es5",      "noImplicitAny": false,      "outDir": "built",      "rootDir": ".",      "sourceMap": false    },    "files": [      "helloworld.ts",      "node_modules/typescript/lib/lib.es6.d.ts"    ],    "exclude": [      "node_modules"    ]  } 

EDIT

In my application I make use of webpack to build my app and I still get the same errors being spat out on the console. I'm currently looking in to fixing this and will report back with what I find.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!