Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PREVIEW_URL support to other iframes #10660

Closed
f1yn opened this issue May 5, 2020 · 6 comments
Closed

Add PREVIEW_URL support to other iframes #10660

f1yn opened this issue May 5, 2020 · 6 comments

Comments

@f1yn
Copy link

f1yn commented May 5, 2020

Is your feature request related to a problem? Please describe.
For Storybook apps that are hosted on remote CDNs, I've been finding it difficult to enable previews and stories without severe compromises.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Make the PREVIEW_URL global available to other iframes as well

Allow developers to use env variables to override this value: https://github.com/storybookjs/storybook/blob/next/lib/components/src/blocks/Story.tsx#L6

It should look like the already existing:

baseUrl: PREVIEW_URL || 'iframe.html',

Having this point to a custom location, either relative or remote, would likely help me and other developers who are using storybook in non standard ways. I.e mounted in a microfront-end, or hosted on a remote CDN.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Right now, I'm using a nginx proxy to match /iframe.html to an externally hosted resources. This isn't a suitable solution for a production environment.

Are you able to assist bring the feature to reality?
Doing this now, if you could make it available in the next beta version that would be incredibly helpful. Just realized that this won't work because of same-origin policy.

Additional context
Add any other context or screenshots about the feature request here.

@stale
Copy link

stale bot commented May 30, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label May 30, 2020
@f1yn
Copy link
Author

f1yn commented Jun 2, 2020

This isn't a feature request, it's a bug. The PREVIEW_URL isn't being consistently handled.

@stale stale bot removed the inactive label Jun 2, 2020
@shilman
Copy link
Member

shilman commented Jun 3, 2020

@flynnham do you want to fix it?

@shilman shilman modified the milestones: 6.0 docs, 6.1 docs Jun 24, 2020
@stale
Copy link

stale bot commented Jul 18, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jul 18, 2020
@f1yn f1yn closed this as completed Jul 20, 2020
@Alonski
Copy link

Alonski commented Aug 3, 2020

I would also like this feature :)

@SebDuf
Copy link

SebDuf commented Mar 15, 2021

Is there a workaround available for this? I've just stumbled on this and thought changing the PREVIEW_URL would solve my issues, but this is still blocking me.

I'm trying to deploy Storybook under /storybook/, here's what I currently have (as per this comment):

build-storybook --preview-url=/storybook/iframe.html

and in main.js:

...
webpackFinal: (config, {configType}) => {
    if (configType === 'PRODUCTION') {
      config.output.publicPath = '/storybook/';
    }

    return config;
},
managerWebpack: (config, {configType}) => {
    if (configType === 'PRODUCTION') {
      config.output.publicPath = '/storybook/';
    }

    return config;
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants