Open sj-dg opened 8 months ago
We devised a workaround until this issue is resolved, we execute a shell script after storybook build step.
This shell script searches for the iframe-*.js
file inside storybook-static/assets/
directory.
Once the file is found, we add the file via <script>
tag inside storybook-static/iframe.html
just before </head>
tag, once that is done, the storybook docker container starts working as usual.
Hi @sj-dg , thanks for providing a workaround. I think your description is missing the tag name before which to add the script tag. Could you add this information - or better yet attach a link to a working shell script? Thanks in advance.
@karo-init Sure here you go,
#!/usr/bin/env sh
# Get the name of the iframe asset file
IFRAME_ASSET_FILE_NAME=$(find ./storybook-static/assets -iname '*iframe*' | xargs -I{} basename {})
# Replace </head> with <script type="module" crossorigin src="./assets/iframe-{hash}.js"></script></head> in iframe.html
sed -i "s|</head>|<script type=\"module\" crossorigin src=\"./assets/${IFRAME_ASSET_FILE_NAME}\"></script></head>|" ./storybook-static/iframe.html
Hi @sj-dg , thanks for providing a workaround. I think your description is missing the tag name before which to add the script tag. Could you add this information - or better yet attach a link to a working shell script? Thanks in advance.
I added which tag we should inject this js file in my comment above. Github does not render </head>
without backticks. 😄
Describe the bug
In our in house storybook implementation we use storybook-vite for our vue components. We have a bot to bump package versions whenever a new one is available. We built our storybook UI and deploy the static site in our internal cloud using Docker.
In the build asset
iframe.html
, there is a line in<head>
which looks like following,This particular line is missing inside Docker container assets but on my machine that line is getting injected correctly.
Because of this missing line inside Docker container, the storybook is not able to render story files hence showing an infinite loader as shown below.
To Reproduce
Make sure along with storybook you have vite package at ">5.1.x"
In your Dockerfile
The entry point can be replaced by any http serve setup, I had used express.
System
Additional context
No response