Skip to content

Commit f9f4740

Browse files
ardataneddeee888
authored andcommitted
feat(cli): use ESM by default (#10705)
* feat(cli): use `ESM` by default * Update graphql-codegen-esm to use esm/bin.js
1 parent 38668a1 commit f9f4740

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

.changeset/wacky-books-post.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@graphql-codegen/cli': patch
3+
---
4+
5+
Use ESM for CLI instead of CJS;
6+
7+
For backwards compatibility; `graphql-codegen-esm` is reserved, and also `graphql-codegen-cjs` is added for users who want to use CJS.
8+
9+
So the commands are;
10+
- `graphql-codegen` - ESM version, default
11+
- `graphql-codegen-esm` - ESM version, same as above, but reserved for backwards compatibility
12+
- `graphql-codegen-cjs` - CJS version, for users who want to use CJS, but not recommended for new users. Will be removed in the future.
13+
- `gql-gen` - ESM version, same as `graphql-codegen`
14+
- `graphql-code-generator` - ESM version, same as `graphql-codegen` and `gql-gen`

packages/graphql-codegen-cli/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
"node": ">=16"
1818
},
1919
"bin": {
20-
"gql-gen": "dist/cjs/bin.js",
21-
"graphql-codegen": "dist/cjs/bin.js",
22-
"graphql-code-generator": "dist/cjs/bin.js",
23-
"graphql-codegen-esm": "dist/esm/bin.js"
20+
"gql-gen": "dist/esm/bin.js",
21+
"graphql-codegen": "dist/esm/bin.js",
22+
"graphql-code-generator": "dist/esm/bin.js",
23+
"graphql-codegen-esm": "dist/esm/bin.js",
24+
"graphql-codegen-cjs": "dist/cjs/bin.js"
2425
},
2526
"main": "dist/cjs/index.js",
2627
"module": "dist/esm/index.js",

0 commit comments

Comments
 (0)