-
-
Notifications
You must be signed in to change notification settings - Fork 821
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
Support custom loaders in ESM format #6660
base: master
Are you sure you want to change the base?
Conversation
I fear that Jest may be transpiling the ESM loader. I'll need to try using another test runner (Vitest or Node)
This one fails like it should for ESM.
|
b3e2b48
to
3c30642
Compare
GraphQL 17 will only be bundled in ESM mode
Description
Use a dynamic
import
when loading custom loaders in order to support loaders in ESM format.Retain the original implementation, which relies on
createRequire
, for the synchronous versionuseCustomLoaderSync
Related #6656
Type of change
How Has This Been Tested?
I could not reproduce the issue using Jest, as it transpiles esm to commonjs.
To keep transpilation to a minimum, I added a test that can be run using the Node.js test runner with type-stripping enabled (requires version 22.6 or later). I also added a convenience script to the root package.json file so that the test can be run using
yarn test:node
I realize that having to use two test runners is not ideal. I'm open to suggestions if there's a simpler way to demonstrate the effectiveness of this fix.
Checklist:
CONTRIBUTING doc and the
style guidelines of this project