Storybook: How to deploy storybook into a subpath

Created on 15 Jun 2017  路  5Comments  路  Source: storybookjs/storybook

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.

question / support

Most helpful comment

the link is broken, can you update it, please?

All 5 comments

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:
screen shot 2018-05-03 at 2 43 13 pm

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?

Was this page helpful?
0 / 5 - 0 ratings