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

Updated with-msw example and fixed race condition + outdated MSW package #54031

Closed
wants to merge 3 commits into from

Conversation

khoi-fish
Copy link

Updated the with-msw example so that it works again.

Changes:

  • Updated tsconfig target to es2017
  • Fixed race condition with msw initialization
  • Updated msw package to pick up bug fixes

Note:

@khoi-fish khoi-fish requested review from a team as code owners August 14, 2023 22:45
@ijjk ijjk added the examples Issue was opened via the examples template. label Aug 14, 2023
@khoi-fish khoi-fish mentioned this pull request Aug 14, 2023
1 task
@@ -1,7 +1,8 @@
import { AppProps } from 'next/app'

if (process.env.NEXT_PUBLIC_API_MOCKING === 'enabled') {
require('../mocks')
const { initMocks } = require('../mocks')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make any difference to make this:

const { initMocks } = await import('../mocks');

@kristojorg
Copy link
Contributor

kristojorg commented Oct 9, 2023

The example does not work for me even with this change on 13.4.0 or greater. It still is unable to intercept the request in getServerSideProps, resulting in a fetch error. I have opened a ticket here: #56608

@leerob
Copy link
Member

leerob commented Nov 17, 2023

I think we'll need a more broad update here with the latest recommendations from msw. Let's start that fresh in a PR. I would like to avoid webpack hacks.

#56608 (comment)

@leerob leerob closed this Nov 17, 2023
@github-actions github-actions bot added the locked label Dec 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template. locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants