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

拉取antdv源码,在安装依赖后进行compile报错 #8049

Open
1 task
zxywftr opened this issue Mar 2, 2025 · 3 comments
Open
1 task

拉取antdv源码,在安装依赖后进行compile报错 #8049

zxywftr opened this issue Mar 2, 2025 · 3 comments

Comments

@zxywftr
Copy link

zxywftr commented Mar 2, 2025

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

[email protected]; [email protected]; Windows 11 家庭版

Reproduction link

https://github.com/zxywftr/ant-design-vue

Steps to reproduce

  1. 拉取[email protected]源码,使用main分支
  2. 使用pnpm安装依赖
  3. 使用命令pnpm compile进行编译

What is expected?

  1. 编译时能够不报错
  2. 运行 https://github.com/zxywftr/testAntdOfVue.git 中的build命令时能够正常的进行构建,而不是报错error TS2742: The inferred type of 'default' cannot be named without a reference to .....

What is actually happening?

  1. 报错error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/[email protected][email protected][email protected]_/node_modules/vue-types'. This is likely not portable. A type annotation is necessary.
  2. 基本上所有组件都报了这个问题, TypeScript: 2038 declaration errors, TypeScript: -1586 emit errors

  1. 我尝试用vite去二次封装antdv
  2. 引入文件后编译报错, 遂寻到antdv源码试着编译,后发现此问题
  3. 业务代码的最小重现在: https://github.com/zxywftr/testAntdOfVue.git
@Limoer96
Copy link

使用yarn或者升级typescript

@zxywftr
Copy link
Author

zxywftr commented Mar 10, 2025

@Limoer96 在升级ts到最新版本后,使用pnpm去打包仍旧报错,但是在未升级ts时,使用yarn却没有报错. 请问这是为什么呢? 比较好奇为啥yarn就能打包成功

@Limoer96
Copy link

@Limoer96 在升级ts到最新版本后,使用pnpm去打包仍旧报错,但是在未升级ts时,使用yarn却没有报错. 请问这是为什么呢? 比较好奇为啥yarn就能打包成功

这是一个老问题了,问题出在pnpm这种包组织方式下TS解析符号链接出错,可以查看这个issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants