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

fix(radio): build site failed in webpack@4.44.0 #25821

Merged
merged 1 commit into from
Jul 27, 2020
Merged

Conversation

kerm1it
Copy link
Member

@kerm1it kerm1it commented Jul 26, 2020

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

fix Radio build site failed in webpack@4.40.0

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Radio cannot render in webpack@4.44.0.
🇨🇳 Chinese 修复 Radio 在 webpack@4.44.0 下无法使用的问题。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Jul 26, 2020

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Jul 26, 2020

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 218bd6b:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

codecov bot commented Jul 26, 2020

Codecov Report

Merging #25821 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #25821   +/-   ##
=======================================
  Coverage   99.52%   99.52%           
=======================================
  Files         374      374           
  Lines        7299     7299           
  Branches     2030     1989   -41     
=======================================
  Hits         7264     7264           
  Misses         35       35           
Impacted Files Coverage Δ
components/radio/index.tsx 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d857800...218bd6b. Read the comment docs.

@kerm1it
Copy link
Member Author

kerm1it commented Jul 26, 2020

我也不知道为什么,凭直觉改的,感觉可能是这的问题 😂

RadioProps,
RadioChangeEventTarget,
RadioChangeEvent,
} from './interface';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原因是 webpack 4.44.0 不支持 export *

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉没啥道理啊,这块导出的不都是 typescript 的东西么?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

说实话,我也有点懵逼,感觉这样写和 export * 没区别。
我猜可能的原因是:export * 现在是不是也会把 默认导出 default 提出来(interface没有默认导出),导致当前模块的默认导出为空?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果这么说那就是 bug,es 的规范里这么做不会包含 default。你是怎么找到这块出错的?

Copy link
Member Author

@kerm1it kerm1it Jul 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,规范里面明确说了 export * 不会包含 default 的。

找到这个还是有运气的成分,我查了 Minified React error #130 这个错误一般都是没有加 exportexport default 造成的,扫了一遍其他地方都没有问题,然后就把 export * 这行删了,发现成功了。。。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 得飞起~

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我们项目页面报了Minified React error #130

挨个排查了一下 才发现RadioGroup是undefined

那是不是webpack的bug?

Copy link
Contributor

@ycjcl868 ycjcl868 Jul 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afc163
Copy link
Member

afc163 commented Jul 27, 2020

成功了。

@afc163 afc163 changed the title fix(radio): build site failed in webpack@4.40.0 fix(radio): build site failed in webpack@4.44.0 Jul 27, 2020
@afc163 afc163 merged commit 366b704 into master Jul 27, 2020
@afc163 afc163 deleted the fix-site-build-failed branch July 27, 2020 02:41
@afc163 afc163 mentioned this pull request Jul 27, 2020
@woodysee
Copy link

I had to extract and rebuild the Radio button from scratch 😢

@kerm1it
Copy link
Member Author

kerm1it commented Jul 30, 2020

找到原因了,确实是 webpack 的 bug。

Issue: #11243

触发时机: 从一个没有任何导出的模块使用 export *, 同时使用export default 时,我们刚好撞上了。

触发原因: 在满足触发时机的模块中,默认导出会变为{},而不是组件的构造函数,从而导致 react 解析组件时出错。

目前已经在 webpack@4.44.1 中修复: v4.44.1

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

Successfully merging this pull request may close these issues.

8 participants