Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: bundleless DTS failed:No inputs were found in config file #4655

Closed
zhangfisher opened this issue Sep 15, 2023 · 9 comments
Closed

[Bug]: bundleless DTS failed:No inputs were found in config file #4655

zhangfisher opened this issue Sep 15, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@zhangfisher
Copy link

Version

System: Windows

@modern-js/module-tools :  2.35.0

Details

使用@modern-js/module-tools构建时出错

同样的配置使用tsup构建成功

错误信息发下:

modern build && cd dist && npm pkg set main=index.js && npm pkg set module=index.mjs && npm pkg set types=index.d.ts

  Modern.js Module v2.35.0

error   ModuleBuildError: 

bundleless DTS failed:

error TS18003: No inputs were found in config file 'E:/Work/Code/sources/flex-tools/node_modules/.dts-temp/DFDrTI2VnLBT14ehAEo8e/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["E:\\Work\\Code\\sources\\flex-tools\\node_modules\\.dts-temp\\DFDrTI2VnLBT14ehAEo8e\\src"]'.


Found 1 error.

    at makeError (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@modern-js\utils\dist\compiled\execa\index.js:1:8677)
    at handlePromise (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@modern-js\utils\dist\compiled\execa\index.js:1:5315)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async generatorDts (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\builder\dts\tsc.js:69:5)
    at async runTsc (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\builder\dts\tsc.js:82:18)
    at async generatorDts (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\builder\build.js:103:5)
    at async E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\builder\build.js:66:7
    at async E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\compiled\p-map\index.js:1:2587
    at Object.run (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\builder\index.js:51:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async build (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\build.js:29:3)
    at async Command.<anonymous> (E:\Work\Code\sources\flex-tools\node_modules\.pnpm\@[email protected][email protected][email protected][email protected]\node_modules\@modern-js\module-tools\dist\command.js:33:5)
 ELIFECYCLE  Command failed with exit code 1.

Reproduce link

https://github.com/zhangfisher/flex-tools

Reproduce Steps

  1. git clone https://github.com/zhangfisher/flex-tools
  2. pnpm build // 默认构建使用@modern-js/module-tools失败
  3. pnpm build:tsup // 成功
@zhangfisher zhangfisher added the bug Something isn't working label Sep 15, 2023
@zhangfisher
Copy link
Author

好象是在生成dts时出错了,但是为什么是缺少/.dts-temp/DFDrTI2VnLBT14ehAEo8e/tsconfig.json',是自己生成的临时配置文件?

@chenjiahan
Copy link
Member

对的,Modern.js Module 会在 node_modules 下面生成一个临时的 tsconfig 文件,并注入一些默认配置(tsup 应该没有这个行为,所以不会有问题)

你需要在根目录的 tsconfig.json 里配置 "include",否则 tsc 编译的时候会无法识别源代码:

{
  "include": ["src"],
}

@chenjiahan
Copy link
Member

@10Derozan 如果用户没有指定 include,我们可以考虑默认注入一个 "include": ["src"] 配置

@zhangfisher
Copy link
Author

之前版本是没问题,直到某次更新后才出现这个问题的,算兼容性问题吧?

编译是可以的,只是无法生成.d.ts

建议默认注入一个 "include": ["src"] 配置

@chenjiahan
Copy link
Member

嗯,我们会再跟进一下这个问题

@zhangfisher
Copy link
Author

这个问题在 2.40.0还没有解决

error   ModuleBuildError: 

bundleless DTS failed:

error TS18003: No inputs were found in config file 'E:/Work/Code/sources/flex-tools/node_modules/.dts-temp/yYiP6KRlNTl7eOuCuR3v4/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["E:\\Work\\Code\\sources\\flex-tools\\node_modules\\.dts-temp\\yYiP6KRlNTl7eOuCuR3v4\\src"]'.

@zhangfisher zhangfisher reopened this Nov 21, 2023
@10Derozan
Copy link
Contributor

加在项目模板里了

@10Derozan
Copy link
Contributor

现在我们不再会开辟新的 temp 目录跑 tsc了,现在会完全遵循用户 tsconfig,这个错误将不再出现。
对于 tsc 来说,input 默认为项目里的所有文件。

@zhangfisher
Copy link
Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants