首页 > 解决方案 > 打字稿编译器(tsc)抛出错误,但仅在纱线脚本中使用时,否则工作正常

问题描述

如果我执行:

tsc

一切都编译,没有问题。在 tsconfig.json 中提取模式

# inside package.json
scripts: { 
  "build" : "tsc" 
}

$ yarn build

抛出错误。

error TS6307: File '***' is not in project file list. Projects must list all files or use an 'include' pattern.

error Command failed with exit code 2.

文件在模式中,因为在tsc没有纱线的情况下运行会产生所需的效果。

为什么会发生这种情况?

标签: typescriptyarnpkgtsc

解决方案


推荐阅读