SyntaxError: Identifier 'builders' has already been declared (9:3)
See original GitHub issueDescribe the bug I’m trying to generate code from my ts files with graphql queries, but I get this error:
SyntaxError: Identifier 'builders' has already been declared (9:3)
at Object._raise (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:776:17)
at Object.raiseWithData (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:769:17)
at Object.raise (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:737:17)
at TypeScriptScopeHandler.checkRedeclarationInScope (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:1392:
12)
at TypeScriptScopeHandler.declareName (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:1358:12)
at TypeScriptScopeHandler.declareName (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:5081:11)
at Object.checkLVal (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:9742:24)
at Object.checkLVal (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:7298:15)
at Object.parseVarId (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:12531:10)
at Object.parseVarId (/usr/src/app/client/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/parser/lib/index.js:7126:11)
To Reproduce Steps to reproduce the behavior: I’ve tried to reproduce the error, but I got a new one. in codesandbox I get
TypeError: Cannot read property 'buildError' of undefined
https://codesandbox.io/s/zen-platform-dowef?file=/schema.gql
- My GraphQL operations:
import { gql } from '@apollo/client';
export const FULL_TASK = gql`
fragment FullTask on Task {
id
title
isCompleted
isStarred
atMyDay
startDate
startDateTime
endDate
endDateTime
rrule
missing
recurringTaskId
project {
id
title
icon
color
backgroundColor
}
}
`;
import { gql } from '@apollo/client';
export const DELETE_TASK_MUTATION = gql`
mutation deleteTask($taskId: String!) {
deleteTask(taskId: $taskId) {
...FullTask
}
}
`;
- My
codegen.yml
config file:
overwrite: true
schema: "./schema.gql"
documents:
- "./**/*.gql"
- "./**/*.ts"
generates:
generated.tsx:
schema: "http://server:3000/graphql"
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo"
Expected behavior It should generate code without any errors
Environment:
"@apollo/client": "3.3.11",
"@graphql-codegen/cli": "1.21.4",
"@graphql-codegen/introspection": "1.18.1",
"@graphql-codegen/typescript": "1.21.0",
"@graphql-codegen/typescript-operations": "1.17.14",
"@graphql-codegen/typescript-react-apollo": "2.2.1",
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Uncaught SyntaxError: Identifier 'x' has already been declared
I am new to JavaScript and webdevelopment and am currently doing a course with Codecademy. I am creating a random message app that...
Read more >Identifier "x" has already been declared" - Ep 11 - YouTube
JS Casts 11 - How to fix "Uncaught SyntaxError : Identifier "x" has already been declared " in JavaScript.
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >PLS-00001 to PLS-01919 - Oracle Help Center
A string literal might have been mistakenly enclosed in double quotes instead of single quotes, in which case PL/SQL considers it a quoted...
Read more >Build Tools Message Reference Manual - NXP
identifier name redeclared was declared as: typeA now declared as: typeB ... An attempt was made to redefine a macro that has already...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@eden-lane Just ran into a similar issue with leftover/untracked declaration files conflicting with type gen. Try using the DEBUG mode to see where exactly the error is coming from. https://www.graphql-code-generator.com/docs/getting-started/codegen-config#debug-mode
💯 This would be wonderful!