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

Using with NuxtIcon: At least one <template> or <script> is required in a single file component #83

Closed
lud-hu opened this issue Dec 11, 2023 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@lud-hu
Copy link

lud-hu commented Dec 11, 2023

I just installed this extension in an existing project with npx storybook-nuxt init and it seems to run fine, but above the Storybook UI there is an error shown:

 ERROR  Internal server error: At least one <template> or <script> is required in a single file component.                                                                            10:16:05 PM
  Plugin: vite:vue
  File: /.../node_modules/nuxt-icons/dist/runtime/components/nuxt-icon.vue

Unfortunately I can't find any help in other issues here or on the web. I also don't understand why the globally available NuxtIcon component could throw this error even though the simple dummy component I use in Storybook is not even using it.

@chakAs3
Copy link
Contributor

chakAs3 commented Dec 11, 2023

please check the version of @storybook-vue/nuxt should be 0.2.0 , nuxt 3.8.1

@chakAs3 chakAs3 self-assigned this Dec 11, 2023
@lud-hu
Copy link
Author

lud-hu commented Dec 12, 2023

Thanks @chakAs3 . I will check it out and get back to you. We are currently on upgrading to Nuxt 3.8.x but it might take a while due to some breaking changes...

@lud-hu
Copy link
Author

lud-hu commented Jan 15, 2024

Hi @chakAs3 ,

we have upgraded to nuxt 3.9.1 and we still get the same error stating

ERROR  Internal server error: At least one <template> or <script> is required in a single file component.                                                                            10:16:05 PM
  Plugin: vite:vue
  File: /.../node_modules/nuxt-icons/dist/runtime/components/nuxt-icon.vue

versions:

"@storybook-vue/nuxt": "0.2.1",
"nuxt": "^3.9.1",
"storybook": "7.6.7",

@chakAs3
Copy link
Contributor

chakAs3 commented Jan 17, 2024

Hi @lud-hu on working on this thanks for reporting this

@chakAs3 chakAs3 added the bug Something isn't working label Jan 17, 2024
@lud-hu
Copy link
Author

lud-hu commented Jan 17, 2024

Thanks @chakAs3 !

After some more investigation in the last days, I've seen that it is caused by e.g. using the <NuxtIcon /> component exported from https://www.npmjs.com/package/nuxt-icons. So I guess the problem is the retrieval of the needed auto imports from nuxt config into the storybook vite config. Hope it helps.

@Ibochkarev
Copy link

@chakAs3 Hello

Please pay attention to this comment as well. storybookjs/storybook#21196 (comment)

@chakAs3
Copy link
Contributor

chakAs3 commented Jan 17, 2024

@lud-hu i have already fixed this in this PR i think #87

@lud-hu
Copy link
Author

lud-hu commented Jan 17, 2024

@chakAs3 cool, good to know! Is there any way I can test it? It seems like the mentioned branch is based on a very old one (0.1.5) and I don't know how to run it locally to test with the latest nuxt version.

@itslewin
Copy link

itslewin commented Feb 8, 2024

Still seeing this issue in a blank repo containing @nuxt/ui and after setup with npx storybook-nuxt init.

@chakAs3
Copy link
Contributor

chakAs3 commented Feb 9, 2024

hi @its-lewin it is not compatible with the new @nuxt/ui, i will need time to figure out the issue.

@alniv94
Copy link

alniv94 commented Mar 25, 2024

image
using nuxt 3.11.1 and nuxtIcon

@tobiasdiez
Copy link
Collaborator

NuxtIcon is declared global (https://github.com/nuxt-modules/icon/blob/094a7f4db76902c95e855d13244a880c442e61c6/src/module.ts#L52) and thus this issue is a duplicate of #4 (which was just fixed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants