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

MSW + React + Vite: Failed to HMR Update if MSW active #2401

Open
4 tasks done
rizaldirnm opened this issue Dec 24, 2024 · 1 comment
Open
4 tasks done

MSW + React + Vite: Failed to HMR Update if MSW active #2401

rizaldirnm opened this issue Dec 24, 2024 · 1 comment
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:browser Related to MSW running in a browser

Comments

@rizaldirnm
Copy link

rizaldirnm commented Dec 24, 2024

Prerequisites

Environment check

  • I'm using the latest msw version
  • I'm using Node.js version 18 or higher

Browsers

Chromium (Chrome, Brave, etc.)

Reproduction repository

https://github.com/rizaldirnm/msw-vite

Reproduction steps

clone repo: https://github.com/rizaldirnm/msw-vite

yarn install

yarn dev

Current behavior

  1. Some how MSW mocking request in asset react.svg
    CleanShot 2024-12-24 at 12 18 19@2x

  2. If we try change something in app, HMR failed to deliver asset because MSW mocked the request
    CleanShot 2024-12-24 at 12 29 55@2x

Expected behavior

MSW should mock only registered handler.

@rizaldirnm rizaldirnm added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:browser Related to MSW running in a browser labels Dec 24, 2024
@shanereid
Copy link

+1

I'm getting the exact same error on a pretty fresh install.

  • I'm on macOS
  • Happens on Chrome, but not Safari
  • { onUnhandledRequest: "bypass" } does not fix the issue.
  • Basically exact error as above, says it hot updates but does not. msw seems to be intercepting hmr requests? (screenshot attached)
  • react 18.3.1
  • vite 5.4.8
  • msw 2.7.0
Screenshot 2025-01-02 at 22 21 52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:browser Related to MSW running in a browser
Projects
None yet
Development

No branches or pull requests

2 participants