-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Provide method to render component island #18596
Comments
My company is on the last leg of migrating to Nuxt 3. We are only missing a way to mock the I see there are many issues (#15265, nuxt-modules/storybook#385, storybookjs/storybook#20312, storybookjs/storybook#21196) around this topic. But your solution @tobiasdiez seems to be the most promising. Is there any way I (or the community) could help creating this framework for storybook? |
This PR may resolve this issue: nuxt/framework#5723. |
@tobiasdiez This looks like a promising start https://github.com/hirotaka/storybook-addon-nuxt |
@shilman Thanks for the pointer. However, this addon tries to follow a completely different approach: Instead of letting Nuxt render the stories, it replicates the nuxt pipeline by copying over the nuxt vite config to storybook. This is similar to how the existing Nuxt 2 module works. Looking at some of the issues in this repo, it feels this approach quickly turns into a cat and mouse problem, where one has to add more and more workarounds for different (edge) cases when nuxt modules etc provide new components or change the vite config. I feel like letting nuxt render the stories will eventually result in a more stable solution. Do you have some experience with how other meta frameworks integrations are handling this? E.g. what is rendered where in the storybook-next integration? |
We currently have an experimental feature from Nuxt test utils: See nuxt/framework#5723. My own view is that the best approach would be to try and expose enough stable config and 'run' the Nuxt entry point so plugins, etc, are set up. This is the approach we've taken in Feel free to DM me to discuss if you would like. |
@tobiasdiez @danielroe Sorry for the late reply on this. Indeed, our current NextJS integration is a cat-and-mouse game and we are looking to replace it with something more robust. I like the look of |
Great! Let me know if there's anything I can do. Feedback on the feature is very welcome 🙏 |
Describe the feature
I would like to have a method
render(island component, props)
that renders a given (island) component and returns the rendered html.I guess this can be archived by fetching
__nuxt_island/<component>
myself, but then I have to take care of properly serializing the props etc.Background: I'm currently working on a nuxt module for storybook, and the idea there would be to let nuxt render the stories and then embed them then in the storybook. Storybook starts its own vite server and you can hook into it by providing an own
render
method. My hope was to create a nuxt instance therenuxt = loadNuxt(...)
and then call something likenuxt.render(StorybookIslandComponent, props: story)
, where theStorybookIslandComponent
would be an component provided by the nuxt module andstory
is the story to be rendered.Additional information
Final checks
The text was updated successfully, but these errors were encountered: