Files from custom directory could not be used in vue components
I set up an interfaces directory but it gives me an error when I try to import a file from it. But when I import the same file in one of composables files with the same path it works
Uncaught SyntaxError: The requested module '/_nuxt/interfaces/player.ts' does not provide an export named 'Player' (at app.vue:10:9)
app,vue
<template>
<div>
<button @click="start">Старт</button>
<pre>{{ player }}</pre>
</div>
</template>
<script setup lang="ts">
import {startGame} from "~/composables/startGame";
import {Player} from "~/interfaces/player";
const player: { value: Player | null } = ref(null);
const start = () => {
player.value = startGame()
}
</script>
interfaces/player.ts
...
export interface Player {
gender: string;
stats: Stats;
skills: Skills;
variables: Variables;
}
0 Replies