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

umijs 3.5.26,@umijs/preset-react 1.8.24在antd 4.21.5以下版本包括4.21.5不抱错,超过4.21.5版本less就报错 #37580

Closed
xiaoliu1990 opened this issue Sep 16, 2022 · 6 comments · May be fixed by xiaoliu1990/antd-umijs-bug#1

Comments

@xiaoliu1990
Copy link

Reproduction link

https://stackblitz.com/

Steps to reproduce

需要配合umijs弄codesandbox不知道怎么搭建,所以写下本地重现的完整步骤:

第一种重现方式:通过umijs来重现错误
安装umijs 3.5.26和@umijs/preset-react 1.8.24:经过试验umijs3.5.26以及以下版本的内置antd是4.20.3版本的,所以这样安装可以直接启动,超过3.5.26版本的umijs或者@umijs/preset-react 1.8.24以上的版本,启动的时候直接就报错了,报错都是

Module build failed (from ./node_modules/@umijs/bundler-webpack/lib/webpack/plugins/mini-css-extract-plugin/src/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/@umijs/bundler-webpack/node_modules/@umijs/deps/compiled/less-loader/cjs.js):

@modal-header-border-color-split: @border-color-split;
@modal-header-close-size: @modal-header-title-line-height 2 * @modal-header-padding-vertical;
^
Cannot read property 'numerator' of undefined
in 磁盘路径\node_modules\antd\es\style\themes\default.less (line 564, column 0)
at 磁盘路径\node_modules@umijs\bundler-webpack\node_modules@umijs\deps\compiled\webpack\4\bundle4.js:109216:20
at 磁盘路径\node_modules@umijs\bundler-webpack\node_modules@umijs\deps\compiled\webpack\4\bundle4.js:61151:11
at 磁盘路径\node_modules@umijs\bundler-webpack\node_modules@umijs\deps\compiled\webpack\4\bundle4.js:61017:18
at context.callback (磁盘路径\node_modules@umijs\bundler-webpack\node_modules@umijs\deps\compiled\webpack\4\bundle4.js:60895:13)

@ ./node_modules/antd/es/input/style/index.js 2:0-22
@ ./src/编写的项目页面/edit.jsx
@ ./src/.umi/core/routes.ts
@ ./src/.umi/umi.ts
@ multi ./node_modules/antd-dayjs-webpack-plugin/src/init-dayjs-webpack-plugin-entry.js ./node_modules/@umijs/preset-built-in/bundled/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js ./src/.umi/umi.ts

error in ./node_modules/antd/es/button/style/index.less

Module build failed (from ./node_modules/@umijs/bundler-webpack/lib/webpack/plugins/mini-css-extract-plugin/src/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/@umijs/bundler-webpack/node_modules/@umijs/deps/compiled/less-loader/cjs.js):

第二种重现方式:单独安装antd来实现
1、安装umijs 3.5.26和@umijs/preset-react 1.8.24
2、安装antd 4.21.6及以上版本都行,启动就会直接报错,报错类型同第一种重现方式

1663314808625

What is expected?

希望升级后能够直接启动。

What is actually happening?

启动后报错,看原因应该是解析less样式的错误。https://docs.github.com/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

Environment Info
antd 4.21.6
React react 18
System Windows 10
Browser Chrome 104.0.5112.102
@afc163
Copy link
Member

afc163 commented Sep 16, 2022

能提供重现仓库么?

@666-arch
Copy link

重现一下

@xiaoliu1990
Copy link
Author

xiaoliu1990 commented Sep 16, 2022

@xiaoliu1990
Copy link
Author

@afc163 @666-arch

@afc163
Copy link
Member

afc163 commented Sep 17, 2022

Broken by #36309

@afc163
Copy link
Member

afc163 commented Sep 17, 2022

你这两行定制的效果应该是想要 xiaoliu1990/antd-umijs-bug#1 这样把,不然感觉不对称很奇怪。

报错原因是 https://github.com/ant-design/ant-design/pull/36309/files#diff-d8d6d0fe74bf058b529f4ad13aa8e51a73b77e6dcb6b8bb3164057e9b4f8921aR564 里 @modal-header-padding-vertical 需要参与计算,不能设置为 **px **px 这样的值。

@afc163 afc163 closed this as completed Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants