pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🐛[BUG]使用ProTable时提示TypeError: (0 , import_useLazyKVMap.default) is not a function

Open midsmr opened this issue 3 months ago • 2 comments

🐛 bug 描述

package.json

"dependencies": {
    "@ant-design/icons": "^5.6.1",
    "@ant-design/pro-components": "3.0.1-0",
    "@reduxjs/toolkit": "^2.8.2",
    "@project/commons": "workspace:*",
    "antd": "^5.27.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-redux": "^9.2.0",
    "react-router": "^7.8.2"
  },
  "devDependencies": {
    "@eslint/js": "^9.34.0",
    "@types/react": "^18.3.24",
    "@types/react-dom": "^18.3.7",
    "@vitejs/plugin-react": "^5.0.1",
    "eslint": "^9.34.0",
    "eslint-plugin-react-hooks": "^5.2.0",
    "eslint-plugin-react-refresh": "^0.4.20",
    "globals": "^16.3.0",
    "typescript": "~5.8.3",
    "typescript-eslint": "^8.41.0",
    "vite": "^7.1.3"
  }

📷 复现步骤

<ProTable
      rowKey="id"
      columns={[
        {
          title: 'ID',
          dataIndex: 'id',
          key: 'id',
          width: 80,
        },
      ]}
      dataSource={[
        {
          id: 1,
          name: 'test',
        },
      ]}
    />

🏞 期望结果

💻 复现代码

© 版本信息

  • ProComponents 版本:3.0.1-0
  • umi版本:未使用umi,vite7,react-router7
  • 浏览器环境 Chrome
  • 开发环境 macOS

🚑 其他信息

midsmr avatar Aug 26 '25 15:08 midsmr

Hi @midsmr! I'm Dosu and I’m helping the pro-components team.

这个错误是因为 ProComponents 3.x 依赖于 Ant Design 的深层导入(如 antd/lib/table/hooks/useLazyKVMap),而这些导入在 Antd 5.x 已经被移除,导致不兼容。解决方法有两个:参考

  1. 将 antd 降级到 4.x(比如 4.24.13),这样可以继续使用 ProComponents 3.x。
  2. 等待 ProComponents 后续版本对 Antd 5.x 的正式支持。

目前没有官方的 workaround 能让 ProComponents 3.x 正常运行在 Antd 5.x 下。如果你需要继续用 ProTable,建议先降级 antd 版本。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

dosubot[bot] avatar Aug 26 '25 15:08 dosubot[bot]

蹲一个3.0啥时候能用 同样报 Uncaught TypeError: antd_lib_table_hooks_useLazyKVMap__WEBPACK_IMPORTED_MODULE_21__ is not a function 错误 退回2.x版本先

echoyl avatar Sep 04 '25 03:09 echoyl