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 am playing around with esm modules, so I am migrating an existing playground project to use esm. I managed to migrate all of the things, but the graphql-codegen. On the main branch, codegen works, but is using as a source a url. This is not production friendly, as we want to generate staff before the code is deployed.
I have created a branch named code-gen-esm and here is what I have got;
file apps/graphql/src/schema/index.ts
import {builder} from '../builder.js';
[...]
export default builder.toSchema();
Once I run the script I am getting Cannot find module './index.js', which seems wrong since in esm we should have suffixes on the imports. Anyway I am removing the suffix so 3rd line of the codegen.ts becomes import schema from './index';
Now I am getting the error: Cannot find module '../builder.js'
This functionality was working fine when I was on commonJS. Is there something that I am doing wrong, or should I stick to commonJS for the time being?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am playing around with esm modules, so I am migrating an existing playground project to use esm. I managed to migrate all of the things, but the graphql-codegen. On the main branch, codegen works, but is using as a source a url. This is not production friendly, as we want to generate staff before the code is deployed.
I have created a branch named
code-gen-esm
and here is what I have got;Once I run the script I am getting
Cannot find module './index.js'
, which seems wrong since in esm we should have suffixes on the imports. Anyway I am removing the suffix so 3rd line of thecodegen.ts
becomesimport schema from './index';
Now I am getting the error:
Cannot find module '../builder.js'
This functionality was working fine when I was on commonJS. Is there something that I am doing wrong, or should I stick to commonJS for the time being?
Beta Was this translation helpful? Give feedback.
All reactions