storyblok / field-plugin

Create and deploy Storyblok Field Plugin
https://www.storyblok.com/docs/plugins/field-plugins/introduction
MIT License
25 stars 3 forks source link

Vue3 Template - Failed to mount component: template or render function not defined. #107

Closed SebbeJohansson closed 1 year ago

SebbeJohansson commented 1 year ago

Describe the bug When trying to run a vue3 plugin, it results in an error. image

To Reproduce Steps to reproduce the behavior:

  1. Run npx @storyblok/field-plugin-cli@alpha
  2. Go into the new field plugin project with cd {what-ever-you-named-it}
  3. Run yarn build
  4. CHeck the errors

Expected behavior I expect no errors.

Screenshots image image

Desktop (please complete the following information):

Additional context I have no idea if this actually causes it to not work properly, or if its just an error with no affect.

johannes-lindgren commented 1 year ago

Hi @SebbeJohansson, thanks for reporting this issue. This is actually the expected behavior. This error occurs because the legacy fieldtype-wrapper.js script is still present in the field plugin's document. This script fails because it expects a Vue 2 component in a certain global variable. We plan to remove this script from the document, which will make the error vanish. Nevertheless, I will keep this issue open until we have addressed that issue.

SebbeJohansson commented 1 year ago

@johannes-lindgren Aaaah okay interesting! Might be worth it to add that to the documentation so that its more clear. Not sure if this issue is clear enough. 🤔

johannes-lindgren commented 1 year ago

@SebbeJohansson I have merged pull request #140 that replaces the error you've spotted with a different error that should be more clear. There will still be an error in the console, but it should be clear that the app is fully functional:

image

That is the best we can do at the moment. I will still keep this ticket open until we have a permanent solution.

SebbeJohansson commented 1 year ago

Looks good! Thanks!

eunjae-lee commented 1 year ago

fixed by #140