I'd like to be able to deploy storybook into the subpath of /storybook, such that I can target everything related to storybook in an nginx config to use my local domain of "https://test.dev".
I read that this is possible in the documentation, but couldn't get it working. If i extend the webpack config like so:
module.exports = (storybookBaseConfig, configType) => {
storybookBaseConfig.output.publicPath = '/storybook/';
// Return the altered config
return storybookBaseConfig;
};
It works for the "manager.bundle.js" and "preview.bundle.js", but not for "iframe.html" or webpack hot reloading or local css imported via absolute paths.
Is there an easy way to make sure that all requests related to running storybook get prefixed with /storybook?
Alternatively, is there a way to run storybook w/ https via the cli? I can set the host to 'test.dev, but I need it to be https for it to work in dev.
If I'm understanding correctly, you'd like test.dev/storybook
to be your static build of storybook.
You can just put everything inside /storybook
in your root nginx server directory. You can use build-storybook -o file_path
to set the directory: https://storybook.js.org/basics/exporting-storybook/
Unfortunately, running https requires certificate generation and it's not on our roadmap.
If there's still an issue, please reopen this.
I am facing the same issue, my storybook is deployed to /storybook
(using webpack publicPath) but the iframe wont follow
so what I get is:
if I manually replace the iframe url to /storybook/iframe.html
everything works as expected, currently there is no way to control the iframe public path right?
@weslleyaraujo our publicPath is ''
by default:
https://github.com/storybooks/storybook/blob/master/app/react/src/server/config/webpack.config.prod.js#L34
This should allow you to serve storybook-static
dir on any route without changing the default config
the link is broken, can you update it, please?
@ozio It looks like it's probably this one: https://github.com/storybookjs/storybook/blob/ecaa84cd889bee6850c50bf4130a479e28aee88b/lib/core/src/server/preview/iframe-webpack.config.js#L124
The base webpack config might be helpful to link too:
https://github.com/storybookjs/storybook/blob/ecaa84cd889bee6850c50bf4130a479e28aee88b/lib/core/src/server/preview/base-webpack.config.js
Most helpful comment
the link is broken, can you update it, please?