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

Bugfix: Use iife version of MSW #711

Merged
merged 12 commits into from
May 16, 2023
Merged

Conversation

madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented May 15, 2023

The msw module version currently doesn't work in a browser. The means that we can not run mocks as part of the test runner. We will also run into the same problems when setting up import maps in web-dev-server as it is the same server as web-test-runner.

@madsrasmussen madsrasmussen marked this pull request as ready for review May 15, 2023 09:50
@madsrasmussen madsrasmussen marked this pull request as draft May 15, 2023 09:51
@madsrasmussen madsrasmussen marked this pull request as ready for review May 15, 2023 10:28
@iOvergaard
Copy link
Collaborator

How come this works under Vite but not web-dev-server?

@madsrasmussen
Copy link
Contributor Author

madsrasmussen commented May 15, 2023

I am not sure what module resolution Vite runs all files through, but they are doing something magical. It is this bug mswjs/msw#1384 we are running into. Hopefully esm support will be possible one day.

Until then it doesn't make a big difference. It is only code we use internally.

@madsrasmussen madsrasmussen changed the title Bugfix: Browser compatible MSW Bugfix: Use iife version of MSW May 15, 2023
Copy link
Collaborator

@iOvergaard iOvergaard left a comment

Choose a reason for hiding this comment

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

LGTM

@iOvergaard iOvergaard enabled auto-merge May 16, 2023 14:10
@iOvergaard iOvergaard merged commit 0c9e4fa into main May 16, 2023
@iOvergaard iOvergaard deleted the bugfix-browser-compatible-msw branch May 16, 2023 14:11
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

Successfully merging this pull request may close these issues.

2 participants