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

How do I get this working with Storybook? #19

Open
Sawtaytoes opened this issue Jul 23, 2021 · 2 comments
Open

How do I get this working with Storybook? #19

Sawtaytoes opened this issue Jul 23, 2021 · 2 comments

Comments

@Sawtaytoes
Copy link

Storybook is using Webpack Dev Server (or Express middleware) internally, but I'm not sure I have access to change it to WebSockets.

Based on your work with Gatsby, is there a way to get Storybook to work with this plugin as well?

@Svish
Copy link
Owner

Svish commented Jul 23, 2021

No clue, sorry. The Gatsby variant was a PR from someone else. If you're able to figure out how to make this work with Storybook, feel free to make a PR and I'll check it out.

@amannn
Copy link

amannn commented Jan 5, 2022

I'm currently using this approach in Storybook which seems to work:

Cypress.on('window:before:load', window => {
  const originalFetch = window.fetch;
  window.fetch = (request, ...rest) => {
    const url = typeof request === 'string' ? request : request.url;

    if (url.endsWith('hot-update.json')) {
      cy.$$('.stop', window.top.document).click();
      cy.$$('.restart', window.top.document).click();
    }

    return originalFetch(request, ...rest);
  };
});

Not sure if @Svish has some ideas on how to improve this based on the other code in this library? Potentially we could add it as a new entry point to this library as well.

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

No branches or pull requests

3 participants