ant-design / ant-design/pro-components

🐛[BUG] @ant-design/pro-field[2.14.6] 导致使用antd 4.x 版本的项目无法正常运行

Open
#8,204 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🐛 bug 描述

项目package.json 依赖`@ant-design/pro-components@ 2.4.4` 和 `antd@4.24.15` 版本。重新安装依赖提示
```sh
10:26:55 AM [vite] hmr update /src/App.tsx
✘ [ERROR] No matching export in "node_modules/.pnpm/antd@4.24.15_react-dom@18.2.0_react@18.2.0/node_modules/antd/es/index.js" for import "ColorPicker"

node_modules/.pnpm/@ant-design+pro-field@2.14.6_antd@4.24.15_react-dom@18.2.0_react@18.2.0/node_modules/@ant-design/pro-field/es/components/ColorPicker/index.js:4:9:
4 │ import { ColorPicker as ColorPickerV5, ConfigProvider, version } fr...
╵ ~~~~~~~~~~~

10:27:01 AM [vite] error while updating dependencies:
Error: Build failed with 1 error:
node_modules/.pnpm/@ant-design+pro-field@2.14.6_antd@4.24.15_react-dom@18.2.0_react@18.2.0/node_modules/@ant-design/pro-field/es/components/ColorPicker/index.js:4:9: ERROR: No matching export in "node_modules/.pnpm/antd@4.24.15_react-dom@18.2.0_react@18.2.0/node_modules/antd/es/index.js" for import "ColorPicker"
at failureErrorWithLog (/workspaces/sandbox/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1651:15)
at /workspaces/sandbox/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1059:25
at /workspaces/sandbox/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1527:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
```

排查了包依赖关系 @ant-design/pro-components 中依赖的@ant-design/pro-field 的包版本为`^2.5.2`,`^2.5.2`最终实际安装版本为`2.14.6`。

``` json
"dependencies": {
"@ant-design/pro-card": "^2.3.2",
"@ant-design/pro-descriptions": "^2.2.3",
"@ant-design/pro-field": "^2.5.2",
...
```
再次排查了之前安装的`@ant-design/pro-field`的包版本是`2.14.2`,这个版本是正常的。
现在`@ant-design/pro-field`默认安装的的包版本是`2.14.6`
对比`@ant-design/pro-field`的`2.14.2` 和`2.14.6` 两个版本 报错的`ColorPicker/index.js` 文件代码,发现`2.14.6`版本下代码
```sh
node_modules/@ant-design/pro-field/es/components/ColorPicker/index.js:4:9
```
```js
import { ColorPicker as ColorPickerV5, ConfigProvider, version } from 'antd';
```

在`antd@4.24.15`版本下 无`ColorPicker` 导出。`pro-components` 中`ProTable`等组件依赖了`ColorPicker` 组件导致启动报错。
希望修复。现在项目无法部署上线

### 📷 复现步骤

复线DEMO:[https://codesandbox.io/p/devbox/pro-components-version-demo-f8dx9h](https://codesandbox.io/p/devbox/pro-components-version-demo-f8dx9h)
附录`package.json`依赖
```json
"dependencies": {
"@ant-design/pro-components": "2.4.4",
"antd": "^4.23.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
```

### 🏞 期望结果
项目package.json 依赖`@ant-design/pro-components@ 2.4.4` 和 `antd@4.24.15` 版本 ,使用`ProTable` 能正常启动项目

### 💻 复现代码

复线DEMO:[https://codesandbox.io/p/devbox/pro-components-version-demo-f8dx9h](https://codesandbox.io/p/devbox/pro-components-version-demo-f8dx9h)
附录`package.json`依赖
```json
"dependencies": {
"@ant-design/pro-components": "2.4.4",
"antd": "^4.23.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
```

### © 版本信息

- ProComponents 版本: [2.4.4]
- umi 版本
- 浏览器环境
- 开发环境 [mac]

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with @ant-design/pro-field/es/components/ColorPicker/index.js, especially the import shown in the report, and inspect the @ant-design/pro-components dependency declarations for the reported versions. Reproduce the failure using the linked CodeSandbox or the supplied package.json with antd 4.24.15; done means ProTable starts successfully with @ant-design/pro-components 2.4.4 and antd 4.x.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.