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

feat: react hmr 支持匿名函数导出 #947

Merged
merged 10 commits into from
Mar 19, 2024
Merged

Conversation

JackGuiYang12
Copy link
Contributor

完成给react 组件默认导出赋默认值:更多内容请看:#931

@sorrycc
Copy link
Member

sorrycc commented Mar 12, 2024

提交前执行下 just ready,这样提上来的代码不会有 clippy 和 format 的问题。

Copy link
Member

@sorrycc sorrycc left a comment

Choose a reason for hiding this comment

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

此外还需要做的两件事是:

1、在 transform.rs 里加入这个 visitor,基于 file.extname 和 file.is_under_node_modules 决定是否装载这个 visitor
2、在 e2e/fixtures 目录新增一个相应的用例

@stormslowly
Copy link
Member

export default ()=>{
  return <div>1</div>
}

@JackGuiYang12 确认下这个会热更吗? 我看 umi 是加了这部分 的 case 的

Copy link
Member

@stormslowly stormslowly left a comment

Choose a reason for hiding this comment

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

有疑问可以找我私聊 ,swc 和 babel 还是挺不一样的

@JackGuiYang12
Copy link
Contributor Author

export default ()=>{
  return <div>1</div>
}

@JackGuiYang12 确认下这个会热更吗? 我看 umi 是加了这部分 的 case 的

好的👌

@JackGuiYang12
Copy link
Contributor Author

export default ()=>{
  return <div>1</div>
}

@JackGuiYang12 确认下这个会热更吗? 我看 umi 是加了这部分 的 case 的

好的👌

https://codesandbox.io/p/sandbox/hotreplacetest-kwdz7q?file=%2Fsrc%2Fcomponents%2FComponent1%2Findex.tsx%3A6%2C10
看起来是可以的,那我是不是需要把这部分代码去掉啊
image

@stormslowly
Copy link
Member

stormslowly commented Mar 17, 2024

NO 你应该使用 mako 的 watch mode 来验证。
试试在 examples/normal 项目下执行 cargo mako . --watch 来验证热更的问题

guiyang and others added 3 commits March 17, 2024 21:55
@sorrycc sorrycc merged commit f9db8bf into master Mar 19, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat/mako_default_name branch March 19, 2024 08:10
@sorrycc sorrycc changed the title feat: 完成default_name feat: react hmr 支持匿名函数导出 Mar 19, 2024
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.

3 participants