【问题标题】:Tsickle says "Error No inputs were found in config file" if I call it with tsconfig.json in a different directory如果我在不同目录中使用 tsconfig.json 调用 Tsickle,则会显示“在配置文件中未找到错误输入”
【发布时间】:2018-01-25 15:38:58
【问题描述】:

用 tickle 打电话

tsickle --externs=target/externs.js -- -p target/src

我收到此错误:

错误在配置文件“target/src/tsconfig.json”中找不到输入。指定的“包含”路径为“[”./my/pathes/**/*.ts“]”,“排除”路径为“[“some/other/thing”]”。

为什么?考虑到tsickle 只是tsc 的包装,如果我进行等效的tsc 调用,它会毫无问题地发生。 tsickle-tsc 交互中一定有问题,但是什么?

【问题讨论】:

    标签: google-closure-compiler tsc tsconfig tsickle


    【解决方案1】:

    根据this Github issue,tsickle 和 typescript 存在一些不兼容问题。

    可能的原因可能是双方都不想承认这是他们的错误,因此他们都不想修复它。

    解决方案是这样的:给 tsickle 的 tsconfig.json 应该有绝对路径,或者这个 tsconfig.json 中的 include: 应该使用绝对路径。

    考虑到.json 格式不是一个非常可配置的东西(例如,您根本不能在其中提供include: [ __dirname + '/my/lib/**.ts' ] 设置),可能更好的选择是简单地提供到tsickle 的绝对路径。

    就我而言,我只是将 Gruntfile 中的 arguments: ['-p', 'src/tsconfig.json'] 扩展为 arguments: ['-p', __dirname + 'src/tsconfig.json']。如果您使用不同的构建工具,您的实际解决方案可能会有所不同,但这是重要的部分。

    【讨论】:

      猜你喜欢
      • 2022-10-02
      • 2018-04-22
      • 2017-05-03
      • 2020-10-07
      • 2017-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多