Skip to content

How to use MSW with Parcel? #557

Answered by kettanaito
zorzysty asked this question in Q&A
Jan 21, 2021 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Hey, @zorzysty.

Have you completed the browser integration steps?

The error that's being shown means that there's no mockServiceWorker.js file served by your app. This can happen because of the following reasons:

  1. You forgot to run npx msw init <PUBLIC_DIR> (see the docs page above for more info).
  2. You've provided the wrong PUBLIC_DIR path, so the worker is not where MSW expects it to be. You can easily check that: this file should exist: http://localhost:XXXX/mockServiceWorker.js, where XXXX is the port where your app is running locally.
  3. Parcel requires to explicitly specify public files (similar to Angular).

I believe if you achieve the /mockServiceWorker.js file being served by the roo…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@zorzysty
Comment options

@kettanaito
Comment options

@zorzysty
Comment options

@kettanaito
Comment options

Answer selected by zorzysty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants