All Questions
Tagged with nuxt.js typescript
501
questions
0
votes
0
answers
26
views
What causes Cannot find module '~/pages/index.vue' or its corresponding type declarations. ts(2307) error while using router.options.ts?
see sample image here
I have a nuxt 3 project and I would like to use custom routing with it. I followed nuxt documentation on custom routing and added a folder named 'app' and inside I created router....
0
votes
0
answers
15
views
Try to set false value using UseQuery Vue
I am learning Vue at the moment. I'm trying to create a loader from the front-end for a table. I set the value true first before getting results from the endpoint so that the loader can work in <...
0
votes
0
answers
18
views
Nuxt.js global middleware keep redirecting me to login after refershing a page after authentification
So i have a globabl middleware that is supposed to portect other routes based on if a token is in local storage
import { parseCookie } from '~/utils/parseCookie';
export default ...
0
votes
0
answers
36
views
Nuxt 3: Page Title Appears as <title>undefined</title> in Google
I'm working on a Nuxt 3 project, and I've encountered an issue where Google search results display my page title as undefined, even though the title appears correctly in the HTML tags. Below is the ...
1
vote
0
answers
53
views
How to correctly type the return values?
I created a custom ofetch instance inside a Nuxt 3 Plugin and I am exposing a wrapper function like this:
const api = $fetch.create({ // ... });
return {
provide: {
api
...
0
votes
0
answers
27
views
does NitroJS (server of NuxtJS) have a Dependency Injection like NestJS at the constructor level from the app singleton or perRequest?
does NitroJS (server of NuxtJS) support dependency injection as the following ?
call any dependency from the class constructor "dependency injection: inversion of control (IoC)" and let the ...
1
vote
0
answers
39
views
Failed to resolve import "#app/composables/script-stubs (Vitest)
I am receiving the error 'Failed to resolve import "#app/composables/script-stubs"' inside the .nuxt folder in the imports.d.ts file
My code is like this and I've tried importing everything.....
0
votes
1
answer
63
views
Configuration Vitest in Nuxt 3
I have a large project made with Nuxt 3, Vue, Pinia, Axios, and TypeScript.
I need help with configuring Vitest to work in my project.
I've had many problems. For example, I wrote a test and it didn't ...
0
votes
0
answers
36
views
Cannot find module './DataTable.vue' or its corresponding type declarations
Im using Nuxt 3, mostly default settings.
My folder structure for a component:
...
├── components
│ ├── MainNav.vue
│ ├── PageHeader.vue
│ ├── data-table
│ │ ├── DataTable.vue
│ │ └── ...
1
vote
0
answers
57
views
Nuxt 3.12.x Layer directory alias type definition error
I got an issue here i tried to resolve but it does not work until now. In my Nuxt.config.ts i got this:
alias: {
'@layer': path.resolve(__dirname, './'),
},
in the tsconfig.json:
"paths&...
1
vote
1
answer
254
views
Using typescript types from the @types folder in Nuxt3
From what I understand. The suggested way to use JavaScript libraries in TypeScript is to install the corresponding *.d.ts files from npm. These are usually found in the @types/ namespace.
This works ...
0
votes
1
answer
79
views
How to Automatically Recognize Type Definitions in Nuxt.js Project Without Explicit Imports in VSCode?
I'm working on a Nuxt.js project with TypeScript and I'm encountering issues with VSCode not recognizing my type definitions automatically. I want to avoid explicitly importing types in every file. ...
1
vote
1
answer
245
views
Unit test error using 'Vitest, @nuxt/test-utils' (SyntaxError: At least one <template> or <script> is required for each file component. )
Objective:
I want to test an API via useFetch from Vuetify components.
Error occurrence:
To achieve this goal, I've used '@nuxt/test-utils/runtime'.
However, I encountered errors in the logs.
To ...
1
vote
0
answers
124
views
Adding Nitro Rollup config options breaks build process in Nuxt app
I'm using Nuxt and I needed to compile a couple specific .ts files into modules to be run. I've added the following into the nuxt.config.ts file:
nitro: {
rollupConfig: {
input: ['./server/...
0
votes
0
answers
59
views
Impossible to set up NX + NUXT typescript workspace properly and use NX libs
I am trying to start a new project with npx create-nx-workspace@latest --preset=nuxt, then create a nx lib with npx nx generate library --bundler=vite, and then use that new lib in my nuxt project.
my ...