vite-plugin-vue2-jsx
vite-plugin-vue2-jsx copied to clipboard
h function context not same as webpack, which is right?
use render function to create customElement;
<template>
<div :style="{ '--node-height': height + 'px' }" class="c-page">
<VTree ref="vtree" class="constraint-tree" :render="renderNode" :nodeMinHeight="height" />
</div>
</template>
renderNode(node: any) {
let compName = 'CNodeCommon'
if (isArray) {
compName = 'CNodeArray'
}
return <compName class="contraint-node" info={info} />
},
webpack use vm.$createElement,context is this
vite use h function, context is the ui-lib's component
vite will show this error; Tried jsx in setup
or methods
both has same problem
Unknown custom element: <CNodeCommon> - did you register the component correctly?
In my case, webpack is more reasonable, because I cannot controll ui lib's component vue-tree lib: https://github.com/wsfe/vue-tree
"vite": "^5.0.11",
"@vitejs/plugin-vue2": "^2.3.1",
"@vitejs/plugin-vue2-jsx": "^1.1.1",
"vue": "^2.7.16",