-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 .mts
extension for codegen file / package.json "type": "module"
#8862
Comments
.mts
extension for codegen file.mts
extension for codegen file / package.json "type": "module"
AFAIK when My problem is I have > graphql-codegen --config codegen.ts
TypeScriptLoader failed to compile TypeScript:
Must use import to load ES Module: codegen.ts
require() of ES modules is not supported.
require() of codegen.ts from node_modules/cosmiconfig-typescript-loader/dist/cjs/index.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from package.json. So I was forced to use yaml config format. |
@mirismaili Yes, this is an upstream dependency issue. |
Having exactly the same issue. |
@xiaoxinghu For now the following workaround is recommended:
|
Is your feature request related to a problem? Please describe.
It is currently impossible to have a
codegen.mts
config.Describe the solution you'd like
Support the
.mts
extension.Describe alternatives you've considered
Use
import()
instead ofrequire()
in order to properly support importing all kinds of modules.Is your feature request related to a problem? Please describe.
No response
The text was updated successfully, but these errors were encountered: