加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

typescript – tsc不包括node_modules

发布时间:2020-12-17 07:24:21 所属栏目:安全 来源:网络整理
导读:{ "compilerOptions": { "target": "es5","module": "commonjs","moduleResolution": "node","sourceMap": true,"emitDecoratorMetadata": true,"experimentalDecorators": true,"removeComments": false,"noImplicitAny": false },"exclude": [ "node_modul
{
  "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"
  ]
}

我正在尝试将angular2 / beta8应用程序升级到RC1,而我正在根据Quickstart指南进行基本重组.

我将其tsconfig.json复制到我的项目目录中.我想我已准备好其他一切,但是当我运行tsc时,我在node_modules文件夹中的文件中会遇到各种错误.为什么它首先在那里寻找?

我不知道你是否找到了这个Alex的答案,但LDL的评论中提到的 question/answer提供了答案,由Srikanth Injarapu提交.

这是答案,以防万一有人不想去那个链接:

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

编辑

在我的应用程序中,我使用webpack来构建我的应用程序,我仍然得到在控制台上吐出的相同错误.我目前正在寻找解决这个问题的方法,并将用我发现的内容进行报告.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读