🐛[BUG]3.0.1-0版本 ProSkeleton 坏掉了
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
🐛 bug 描述
使用ProSkeleton组件时会有找不到构建依赖的情况发生,抛出异常。
📷 复现步骤
安装[email protected] @ant-design/[email protected]
引入ProSkeleton组件,type 传入list
降回到3.0.0-beta.3问题就消失了。
Hi @Ives7! I'm Dosu and I’m helping the pro-components team.
这个问题的根本原因是 ProSkeleton 组件在 3.0.1-0 版本中,ListSkeleton 和 DescriptionsSkeleton 相关实现直接从 antd/lib/grid/hooks/useBreakpoint 进行导入,但这个路径属于 antd 的内部实现,并不是公开 API,容易在 antd 升级(如 5.26.7)后出现“找不到依赖”或“不是函数”的报错(如 antd_lib_grid_hooks_useBreakpoint__WEBPACK_IMPORTED_MODULE_3__ is not a function)参考。
pro-components 实际上有自己的 useBreakpoint 工具(src/utils/useMediaQuery/index.ts),用于兼容不同 antd 版本和响应式断点。3.0.0-beta.3 版本没有这个问题,很可能是因为它用的是本地工具而不是 antd 内部路径。
临时解决方案:可以继续使用 3.0.0-beta.3,或者自行 patch 3.0.1-0,把相关组件的 useBreakpoint 导入改为本地实现(src/utils/useMediaQuery),避免依赖 antd 内部路径。
建议后续关注官方修复,或在升级 pro-components 时注意相关 breaking change。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other