Within my project, I have a file called @/graphql/mutations.graphql
which contains the following code:
mutation addCharacterToUser($userId: ID!, $characterId: ID!) {
addCharacterToUser(userId: $userId, characterId: $characterId) {
characterIds
}
}
mutation newCharacter ($name: String!, $age: Int!) {
newCharacter(character: {name: $name, age: $age}) {
id
}
}
I am currently utilizing this file in one of my Vue.js components that is built with TypeScript. However, upon running npm run build
, an error arises as shown below:
error in C:/Development/Project/src/components/character/CharacterCreationDialog.vue
ERROR in C:/Development/Project/src/components/character/CharacterCreationDialog.vue(59,50):
59:50 Cannot find module '@/graphql/character/mutations.graphql' or its corresponding type declarations.
57 | <script lang="ts">
58 | import Vue from 'vue'
> 59 | import { addCharacterToUser, newCharacter } from '@/graphql/character/mutations.graphql'
| ^
60 |
61 | export default Vue.extend({
62 | name: 'CharacterCreationDialog',
Despite conducting some research, I am struggling to pinpoint the exact issue at hand due to my limited experience with TypeScript.