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

fix: directive for vue 2.7 #487

Merged
merged 2 commits into from
Aug 9, 2022
Merged

fix: directive for vue 2.7 #487

merged 2 commits into from
Aug 9, 2022

Conversation

sxzz
Copy link
Member

@sxzz sxzz commented Aug 9, 2022

Description

In Vue 2.7, render is renamed to _sfc_render.

Linked Issues

Additional context

@sxzz sxzz requested a review from antfu as a code owner August 9, 2022 07:33
@antfu antfu merged commit 9d9108b into main Aug 9, 2022
@antfu antfu deleted the fix/vue2-directives branch August 9, 2022 17:37
@cczw2010
Copy link

cczw2010 commented Sep 16, 2022

[unplugin-vue-components:directive] Cannot find render function position.

which is always in this last 0.22.7 fix version.

I'm work with rollup:

  1. vue@2.7.10

  2. unplugin-vue-component@0.22.7

  3. rollup-plugin-vue@5.1.9

I found the source:

["render", "_sfc_render".includes(node.declarations[0].id.name)

and debug:

console.log(node.declarations[0].id.name) //output like:__vue_render__

@sxzz

@sxzz
Copy link
Member Author

sxzz commented Sep 17, 2022

rollup-plugin-vue is deprecated. Try unplugin-vue or @vitejs/plugin-vue

@cczw2010
Copy link

ok, but my project is base rollup & vue2

@sxzz
Copy link
Member Author

sxzz commented Sep 17, 2022

@cczw2010
Copy link

@cczw2010 Try this demo https://github.com/sxzz/vue2-directive-demo

I'll try. And if possiable ,hope to add this small modification in the next version.

@sxzz
Copy link
Member Author

sxzz commented Sep 18, 2022

PR welcome

@sconix
Copy link

sconix commented Sep 22, 2022

We are still getting the error of [unplugin-vue-components:directive] Cannot find render function position.

Not sure whats wrong, but still not able to use vuetify directives.

vite@3.1.3
unplugin-vue-components@0.22.7
@vitejs/plugin-vue2@2.0.0
vue@2.7.10

Edit: It seems to work if I move the ' const renderStart = getRenderFnStart(ast)' back to the place where it was before this PR was merged. @sxzz was that intentional change and why was it made?

@sxzz
Copy link
Member Author

sxzz commented Sep 22, 2022

Could you please open an issue and provide a reproduction?

https://antfu.me/posts/why-reproductions-are-required

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.

None yet

4 participants