[Solved] Histoire + TwicPics components #773
did
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
👋 Histoire uses a stub NuxtApp instance when rendering a Story. I guess it does this to avoid potential lib conflicts and to keep the rendering as fast as possible. I don't know.
Anyway, the problem with this approach is that some Nuxt libraries / plugins like TwicPics won't be able to expose their own custom components while those generally global components seems to be correctly setup and compiled.
They're just completely unavailable in the Story component and its children.
Here is a hack I found out to make them globally available. I don't care if it's dirty or not as long as it works in Histoire.
First, I've created a plugin named
plugins/twicpics-hack.client.ts
Then, I created proxy Twicspics components in
histoire/components/twicpics
like this one for theTwicImg
component:Make sure you registered your
histoire/components
folder innuxt.config.ts
:NOTE: it might also solve the issue described here #668.
Beta Was this translation helpful? Give feedback.
All reactions