storybook
storybook copied to clipboard
Can't build directly into `static` dir
Version
@nuxtjs/storybook: v4.0.4 nuxt: v2.15.7
Reproduction Link
https://codesandbox.io/s/confident-leavitt-65nxb
Steps to reproduce
I've added a couple scripts to illustrate my issue.
storybook:build-worksshows how you can build Storybook using the defaults and there's no issues.storybook:build-breaksshows how if you try to build Storybook into the/staticdir, the module will recursively copy the contents of the folder inside itself until the OS prevents from creating things in that dir.
What is Expected?
I would expect the module to remove the previous build dir (it already does this). Then if the user has specified a custom --output-dir, the module should check if that path is inside --static-dir.
If it is not inside --static-dir, I think everything works fine. If it is inside, the module should copy the contents of the static folder except for the folder that will be our --output-dir.
What is actually happening?
Because I'm trying to deploy my Storybook with my website, when the module copies my static files to the Storybook build dir, it also copies Storybook's dir. This causes said dir to be infinitely nested/duplicated.
I think this is causing my CodeSandbox example to not demo the issue properly. Try running it locally if it's still not clear what's going on. Find attached a screenshot showing how my static dir looks like after a build.
screenshot

For anyone trying to deploy their storybook dir with their website, this script allows you to workaround the described issue:
rm -r -f static/storybook && nuxt storybook build && mv storybook-static static/storybook
v4 of this module is no longer actively supported. Please try the newest version and open an new issue if the problem persists. Thank you for your understanding.