You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ npm start
> start
> npm run gen && npm run lint
> gen
> graphql-codegen-esm✔ Parse Configuration⚠ Generate outputs ❯ Generate to __generated__/test.txt ✔ Load GraphQL schemas ✔ Load GraphQL documents ✖ Invalid Custom Plugin "./my-plugin.js" Plugin ./my-plugin.js does not export a valid JS object with "plugin" function. Make sure your custom plugin is written in the following form: module.exports = { plugin: (schema, documents, config) => { return 'my-custom-plugin-content'; }, };
Describe the solution you'd like
Allow graphql-code-generator to load ESM plugin like CJS plugin.
Describe alternatives you've considered
No response
Is your feature request related to a problem? Please describe.
No response
Workaround
It seems to work if I export the plugin function with named export. However, I think it is better to use the default export.
- Keep `@mizdra/graphql-codegen-typescript-fabbrica` as CJS because of dotansimha/graphql-code-generator#9896
- Convert `@mizdra/graphql-codegen-typescript-fabbrica` to ESM
mizdra
changed the title
Support ESM plugin
ESM plugin should be default exportable
Mar 10, 2024
mizdra
changed the title
ESM plugin should be default exportable
ESM plugin should be exportable with export defaultMar 10, 2024
Is your feature request related to a problem? Please describe.
I want to write a plugin as ESM. But graphql-code-generator cannot load ESM plugin.
Describe the solution you'd like
Allow graphql-code-generator to load ESM plugin like CJS plugin.
Describe alternatives you've considered
No response
Is your feature request related to a problem? Please describe.
No response
Workaround
It seems to work if I export the plugin function with named export. However, I think it is better to use the default export.
The text was updated successfully, but these errors were encountered: