Conversation
|
Hey, @penalosa. Thanks for proposing this. I believe what you're proposing can already be done by the developer, that is creating a custom As of now, I see no reason to add a new export or support
What do you think? |
|
Hey @kettanaito! Our main goal is to make this as simple as possible for developers trying to use MSW with Cloudflare, and so it felt like a simple API: import { setupServer } from "msw/workerd"
export const server = setupServer()would match that goal well, rather than end-users having to understand the details of MSW & interceptors (of course, we'd document the right setup, but the DX of In terms of the specific issues with existing APIs, as it stands today the custom In testing, the |
|
Given the export conditions for CF Workers, I wonder if This is a good use case for us to explore how to provide all the necessary APIs for users to build their own As I mentioned before, the That being said, I'm most certain we won't support CF Workers with the changes proposed here. If you don't mind, I will close this pull request. Let's continue collaborating on this in the issue instead. |
Fix #2637
This PR adds a
msw/workerdentrypoint in order to expose asetupServer()API compatible with theworkerdruntime (i.e. just afetch()interceptor). I've added this as a new entrypoint to fit the existing setup, but I wonder if at some point it might make sense to just have amsw/setupentrypoint that exposed different browser, node, react-native, and workerd export conditions?This is called
workerdto match the WinterCG list of runtime keys: https://runtime-keys.proposal.wintercg.org/#workerd