Skip to content

Unhandled request for webpack files during Next.js fast refresh #978

Answered by kettanaito
ryandi-tiket asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, @ryandi-tiket. Thanks for raising this.

MSW intercepts all outgoing requests on the page, including those from webpack's Fast Refresh. It's hard for us to assume which requests are internal (such as webpack's request) and which are intended by you. We delegate that decision to you instead.

You see the warnings because MSW warns you on unhandled requests by default. I understand that seeing such warnings from internal tooling pollutes the console, so you have a few options to opt out of this behavior.

(Recommended) Option 1: Whitelist internal requests

worker.start({
  onUnhandledRequest(request) {
    // Whenever there's an unhandled request which path
    // starts from "/_next", ig…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ryandi-tiket
Comment options

@kettanaito
Comment options

@ryandi-tiket
Comment options

Answer selected by ryandi-tiket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working scope:browser Related to MSW running in a browser
2 participants
Converted from issue

This discussion was converted from issue #977 on November 10, 2021 10:43.