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

Replace error #83

Open
lif3ng opened this issue Dec 31, 2023 · 0 comments
Open

Replace error #83

lif3ng opened this issue Dec 31, 2023 · 0 comments

Comments

@lif3ng
Copy link

lif3ng commented Dec 31, 2023

s.replace(/(createElementVNode|createVNode|createElementBlock) as _\1,?/g, (_, name) => {
fn.add(name)
return ''
})
if (!fn.size)
return
s.appendLeft(0, `/* Injection by vite-plugin-vue-inspector Start */
import { ${Array.from(fn.values()).map(i => `${i} as __${i}`).join(',')} } from 'vue'
function _interopVNode(vnode) {
if (vnode && vnode.props && 'data-v-inspector' in vnode.props) {
const data = vnode.props['data-v-inspector']
delete vnode.props['data-v-inspector']
Object.defineProperty(vnode.props, '__v_inspector', { value: data, enumerable: false })
}
return vnode

before:

import { createTextVNode as _createTextVNode2, createVNode as _createVNode2, resolveComponent as _resolveComponent2 } from "vue";

after:

...
function _createVNode(...args) { return _interopVNode(__createVNode(...args)) }
...
import { createTextVNode as _createTextVNode2, 2, resolveComponent as _resolveComponent2 } from "vue";

可能是由于对于部分组件文件使用jsx,导致的打包时重复引入,对于_createVNode2的别名情况未处理

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

No branches or pull requests

1 participant