Skip to content

Commit

Permalink
fix(cli): Switch between ESM/CJS in CLI entrypoint (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten authored Apr 24, 2024
1 parent e69b48f commit 763d7d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-boats-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gql.tada": patch
---

Switch between ESM and CJS when running CLI.
9 changes: 8 additions & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
#!/usr/bin/env node
require('../dist/gql-tada-cli.js');

(async function main() {
try {
await import('../dist/gql-tada-cli.mjs');
} catch (_error) {
require('../dist/gql-tada-cli.js');
}
})();
2 changes: 1 addition & 1 deletion scripts/eslint-preset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
parserOptions: {
ecmaVersion: 9,
ecmaVersion: 2023,
sourceType: 'module',
ecmaFeatures: {
modules: true,
Expand Down

0 comments on commit 763d7d4

Please sign in to comment.