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
I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.8.0
Amplify CLI Version
12.6.0
What operating system are you using?
Mac
Amplify Codegen Command
codegen statements
Describe the bug
When generating GraphQL queries with TypeScript the types import does not use correct module resolution for ESM.
src/graphql/mutations.ts:5:27 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../API.js'?
5 import * as APITypes from "../API";
~~~~~~~~
src/graphql/queries.ts:5:27 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../API.js'?
5 import * as APITypes from "../API";
~~~~~~~~
src/graphql/subscriptions.ts:5:27 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../API.js'?
5 import * as APITypes from "../API";
~~~~~~~~
# Put your logs below this line
src/graphql/mutations.ts:5:27 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../API.js'?
5 import * as APITypes from "../API";
~~~~~~~~
src/graphql/queries.ts:5:27 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../API.js'?
5 import * as APITypes from "../API";
~~~~~~~~
src/graphql/subscriptions.ts:5:27 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../API.js'?
5 import * as APITypes from "../API";
~~~~~~~~
Additional information
We will likely need to add a new codegen configuration for this option (such as moduleResolution).
The text was updated successfully, but these errors were encountered:
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v18.8.0
Amplify CLI Version
12.6.0
What operating system are you using?
Mac
Amplify Codegen Command
codegen statements
Describe the bug
When generating GraphQL queries with TypeScript the types import does not use correct module resolution for ESM.
See for additional details: https://github.com/dpilch/codegen-esm-error
Expected behavior
The imports should have
.js
when using ESM.Reproduction steps
See sample app here: https://github.com/dpilch/codegen-esm-error
GraphQL schema(s)
Any GraphQL schema will have this issue.
Log output
Additional information
We will likely need to add a new codegen configuration for this option (such as
moduleResolution
).The text was updated successfully, but these errors were encountered: