-
Notifications
You must be signed in to change notification settings - Fork 149
fix: optimize shouldTransformedToSlots judgement #518
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
Conversation
|
单测补一下 |
| expect(wrapper.html()).toBe('<div>123</div><div>456</div>'); | ||
| }); | ||
|
|
||
| test('_Fragment already imported', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/babel-plugin-jsx/test/snapshot.test.ts 整到这个文件里面吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来可以这样。
| const fragmentTests = [{ | ||
| name: '_Fragment already imported', | ||
| from: ` | ||
| import _Fragment from 'example' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import _Fragment from 'example' | |
| import { Fragment } from 'vue' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样没改前也能通过测试,因为_Fragment是编译SFC多根节点模板时生成的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { Fragment as _Fragment } from 'vue' 这样吧
🤔 What is the nature of this change?
🔗 Related Issue
vitejs/vite#5064
由于vue模板编译已经导入_Fragment,jsx插件对插槽的判断会出现错误,导致fragment的内容转换为插槽,从而无法显示
例如编译代码:
结果:
💡 Background or solution
用正则优化对fragment的判定
📝 Changelog
☑️ Self Check before Merge