Open
Description
Version
4.4.0
OS Version
Windows 11 23H2
Node.js Version
v18.16.1
Link to minimal reproduction
https://github.com/kukushouhou/umi-plugin-test
Steps to reproduce
通过脚手架直接生成工程后编译就能复现错误,以下是日志
F:\JavaScript\umi-plugin-test>npx create-umi@latest
┌ create-umi
│
○ Pick Umi App Template
│ Umi Plugin
│
○ Pick Npm Client
│ npm
│
○ Pick Npm Registry
│ taobao
│
○ What's the plugin name?
│ umi-plugin-test
│
└ You're all set!
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @stylelint/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @floating-ui/[email protected]: Package renamed to @floating-ui/react
added 1044 packages in 21s
F:\JavaScript\umi-plugin-test>npm run build
> [email protected] build
> father build
info - Clean output directories
info - Bundless for src directory to cjs format
event - Bundless src/index.ts to dist\cjs\index.js (with declaration)
event - Generate declaration file...
error - TS5055: Cannot write file 'F:/JavaScript/umi-plugin-test/dist/cjs/index.js' because it would overwrite input file.
error - Error: Declaration generation failed.
at getDeclarations (F:\JavaScript\umi-plugin-test\node_modules\father\dist\builder\bundless\dts\index.js:200:19)
at transformFiles (F:\JavaScript\umi-plugin-test\node_modules\father\dist\builder\bundless\index.js:79:58)
at async bundless (F:\JavaScript\umi-plugin-test\node_modules\father\dist\builder\bundless\index.js:107:19)
at async builder (F:\JavaScript\umi-plugin-test\node_modules\father\dist\builder\index.js:55:25)
at async Command.fn (F:\JavaScript\umi-plugin-test\node_modules\father\dist\commands\build.js:15:13)
at async Service.run (F:\JavaScript\umi-plugin-test\node_modules\@umijs\core\dist\service\service.js:328:15)
at async Service.run2 (F:\JavaScript\umi-plugin-test\node_modules\father\dist\service\service.js:58:16)
at async Object.run (F:\JavaScript\umi-plugin-test\node_modules\father\dist\cli\cli.js:37:9)
What is expected?
预期是能正常输出.d.ts文件.
What is actually happening?
实际输出.d.ts文件时报"cjs/index.js"文件已存在的错误
Any additional comments? (optional)
我尝试Debug找问题没找到.
我尝试把断点打到getDeclarations方法上,然后编译中断时把"cjs/index.js"文件删除后继续执行,就能正常编译出"cjs/index.d.ts"文件.
info - Clean output directories
logger.js:118info - Bundless for src directory to cjs format
logger.js:122event - Bundless src/index.ts to dist\cjs\index.js (with declaration)
logger.js:122event - Generate declaration file...
logger.js:122event - Transformed successfully in 8686 ms (1 files)
感觉应该是判断文件是否存在的方法传参传错了,但我没找到这个方法具体在哪里
试过降级到v4.3.8和v4.3.7问题依然存在,也在MacOS下尝试过问题一致
Metadata
Assignees
Labels
No labels