I'm trying to run a @storybook-server instance that fetches HTML files from a local directory, instead of a running server.
By documentation the HTML files (with respective paths) should come from a remote - or local - server, as below
export const parameters = {
server: {
url: `http://localhost:${port}/storybook_preview`,
},
};
However, since my HTML is SSG I would like to have a way to run the storybook against a local directory containing my files, without having to run a separate node server just to serve these static files.
I have a test.html file on my src folder, and its respective story pointing to its filename
{
"title": "Example/test",
"parameters": {
"server": { "id": "test.html" }
},
"stories": [
{
"name": "Main"
}
]
}
I tried with
export const parameters = {
server: {
url: 'file://' + path.resolve('src'),
},
};
but that, unfortunately, generated an error on the storybook stating
Failed to fetch
TypeError: Failed to fetch
at _callee$ (http://localhost:6006/vendors~main.iframe.bundle.js:9510:20)
at tryCatch (http://localhost:6006/vendors~main.iframe.bundle.js:46534:40)
at Generator.invoke [as _invoke] (http://localhost:6006/vendors~main.iframe.bundle.js:46765:22)
at Generator.next (http://localhost:6006/vendors~main.iframe.bundle.js:46590:21)
at asyncGeneratorStep (http://localhost:6006/vendors~main.iframe.bundle.js:9472:103)
at _next (http://localhost:6006/vendors~main.iframe.bundle.js:9474:194)
at http://localhost:6006/vendors~main.iframe.bundle.js:9474:364
at new Promise (<anonymous>)
at http://localhost:6006/vendors~main.iframe.bundle.js:9474:97
at defaultFetchStoryHtml (http://localhost:6006/vendors~main.iframe.bundle.js:9525:17)
Any suggestion would be highly appreciated!
For those who might find themselves in the same situation:
I got rid of @storybook/server and opted for @storybook/html, which was more suitable to my case