Skip to content

Setting publicPath almost works. #3172

@manuphatak

Description

@manuphatak

Issue details

Overriding config.output.publicpath does not work.

Here's the scenario:

As a developer, I want QA and Design teams to be able to review storybook on review apps. I want to be able to publish storybook as a path on my main app: for example pr-2200.example.com/storybook/.

If I set public path, it almost works:

// .storybook/webpack.config.js
module.exports = (storybookBaseConfig, configType) => {
  if (configType === 'PRODUCTION') {
    storybookBaseConfig.output.publicPath = '/storybook/'
  }

  return storybookBaseConfig
}

There's one line, that seems to ignore webpack's publicPath:
https://github.com/storybooks/storybook/blob/abd4f0ef697c0b62ee724fd88e3c245efd4bd912/lib/core/src/client/manager/provider.js#L34

As a hack, I can fix this, by creating a redirect on my server.

For example, on rails, I can do:

  # config/routes.rb
  get 'iframe.html', to: redirect(path: '/storybook/iframe.html')

(edited this snippet): redirect('/storybook/iframe.html') -> redirect(path: '/storybook/iframe.html'). This subtle change forwards url params with the redirect.

And everything works!

It would better if everything worked without creating a redirect on my server.

Please specify which version of Storybook and optionally any affected addons that you're running

  • storybook/react "3.2.x"

Affected platforms

  • React version of the app.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions