在tsconfig.json中包含多个node_modules

时间:2018-01-06 07:40:40

标签: angular typescript

我正在使用Angular Angular 4.x迁移到Angular 5我的项目。我面临过

ERROR in ./node_modules/api-ai-javascript/index.ts 

所以我在tsconfig.json中更改了以下更改,

"include": [
    "src/**/*",
    "node_modules/api-ai-javascript/index.ts"
  ]

仍然获得/node_modules/ng2-stomp-service/dist/stomp.service.ts如何添加包含多个node_modules?

编辑:

 "include": [
    "src/**/*",
    {"node_modules/api-ai-javascript/index.ts"},
    {"node_modules/ng2-stomp-service/dist/stomp.service.ts"},
  ]

获取expected token } in JSON at position 439.

2 个答案:

答案 0 :(得分:2)

关于无效的json,这是因为“include”必须是字符串数组。试试那个

"include": [
    "src/**/*",
    "node_modules/api-ai-javascript/index.ts",
    "node_modules/ng2-stomp-service/dist/stomp.service.ts"

答案 1 :(得分:-1)

在位置439的JSON中获取预期令牌}。

这意味着JSON文件中出现了问题。很可能它是

stomp.service.ts"}之后的最后一个逗号
 "include": [
    "src/**/*",
    {"node_modules/api-ai-javascript/index.ts"},
    {"node_modules/ng2-stomp-service/dist/stomp.service.ts"},
  ]