babel-plugin-jsx
babel-plugin-jsx copied to clipboard
[Bug] [Vue warn]: Invalid VNode type: undefined (undefined)
🐛 Bug description
Repro: https://github.com/wenfangdu/el-plus-repro/tree/invalid-vnode-type
Please clone the repo and run it.
Source:
import { defineComponent } from 'vue'
const Comp = defineComponent({
setup(props, { slots }) {
return () => (
<div>
Comp
{slots.default()}
</div>
)
},
})
export default defineComponent({
setup() {
// 👇 spreading an empty object will cause this issue
return () => <Comp>{{ default: () => 1, ...{} }}</Comp>
},
})
Warning:
runtime-core.esm-bundler.js?5c40:38 [Vue warn]: Invalid VNode type: undefined (undefined)
at <Anonymous>
at <App>
🏞 Desired result
No warnings.
@Amour1688 I've updated the repro to be as minimal as possible, please have a look.
it's weird.
@Amour1688 Yes, it is. Using Object.assign would have no problem, only spreading throws:
export default defineComponent({
setup() {
// 👇 no problem
return () => <Comp>{Object.assign({ default: () => 1 }, {})}</Comp>
},
})
You can use <Comp v-slots={{ default: () => 1, ...{} }} /> temporarily
我也出现了这个问题,虽然不影响程序执行,但是这个警告却是看着不舒服 我只是简单的写了一个hellworld.tsx 然后在app.tsx import 进来使用 结果也跟你一样的警告提示