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
The GraphQL Codegen creates two files: admin.types.d.ts and admin.generated.d.ts. The codegen preset automatically adds an import statement at the top of the admin.generated.d.ts file to include the required base types. However, when using "type": "module" in the package.json, the import statement is invalid because you are required to specify the .js file extension. There is currently no way to configure this behavior to allow the codegen to generate the correct import path with the .js extension. This means that I have to manually update the generated files after each codegen run or copy the code from the repository.
Expected behavior
There should either be an option to update the import or the codegen should detect when it is used inside an ESM module.
Actual behavior
The import statement in the generated admin.generated.d.ts file does not include the required .js extension when using "type": "module" in package.json, resulting in an invalid import. This forces developers to either manually edit the file after each codegen run or maintain a custom codegen setup.
Steps to reproduce the problem
Set "type": "module" in package.json.
Run the GraphQL codegen.
Inspect the generated admin.generated.d.ts file.
Notice the incorrect import statement that doesn't include the .js extension, causing issues when trying to import from admin.types.
Issue summary
The GraphQL Codegen creates two files:
admin.types.d.ts
andadmin.generated.d.ts
. The codegen preset automatically adds an import statement at the top of theadmin.generated.d.ts
file to include the required base types. However, when using"type": "module"
in thepackage.json
, the import statement is invalid because you are required to specify the.js
file extension. There is currently no way to configure this behavior to allow the codegen to generate the correct import path with the.js
extension. This means that I have to manually update the generated files after each codegen run or copy the code from the repository.Expected behavior
There should either be an option to update the import or the codegen should detect when it is used inside an ESM module.
Actual behavior
The import statement in the generated
admin.generated.d.ts
file does not include the required.js
extension when using"type": "module"
inpackage.json
, resulting in an invalid import. This forces developers to either manually edit the file after each codegen run or maintain a custom codegen setup.Steps to reproduce the problem
"type": "module"
inpackage.json
.admin.generated.d.ts
file..js
extension, causing issues when trying to import fromadmin.types
.Debug logs
The generated output looks like this:
The text was updated successfully, but these errors were encountered: