mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.97k stars 519 forks source link

fix: revert the lazy import of `graphql` #2298

Open grebenyuksv opened 1 month ago

grebenyuksv commented 1 month ago

This reverts the recent attempts to import graphql lazily, which we agreed to do in https://github.com/mswjs/msw/pull/2250#issuecomment-2382625016.

kettanaito commented 1 month ago

Thanks for opening this, @grebenyuksv. Can you please remind me what issue are you facing with the dynamic require?

I have a suspicion that merging this will cause errors for ESM consumers. Importing anything from the root results in an import to parseGraphQL, and then errors that the graphql package is not installed.

kettanaito commented 1 month ago

I'm concerned that this change will make https://github.com/mswjs/msw/issues/2248 an issue again.

Perhaps we should take a closer look at why your use case errors, @grebenyuksv.

grebenyuksv commented 1 month ago

Thanks for your review, @kettanaito! Let's close it for now. I've parked that Storybook project where the dynamic import doesn't work and, as I said, I would rather bet that the problem is in other tooling, not in MSW.