Nuxt

N

Nuxt

Nuxt Community Chat Server

Join

Typescript and useFetch transform

I have fairly persistent issues with useFetch() and transform in typescript ; transform seems to expect the shape of the response not to change, which (at least for me) defeats the purpose ```ts export default async function() { return useAPI('/messages', { transform: (data: { messages: Message[] }) => data.messages,...

Nuxt3 Generate - static assets relative path

Hello guys, when using npm run generate, how to set a relative path to _nuxt folder assets? i want to serve it via electron, inside the src folder...
No description

Seeing helper.removeColorScheme is not a function from color-mode module

I am getting a new error from within my test runs. It causes quite a bit of noise in my test output. Anyone know why /how to fix this? ``` TypeError: helper.removeColorScheme is not a function ❯ ../../node_modules/@nuxtjs/color-mode/dist/runtime/plugin.client.js:86:12 84| window.document.head.appendChild(style);...

Nuxt errors after refreshing package-lock.json (A composable that requires access...)

I'm getting the following errors after refreshing my package-lock.json/updating some packages: Error: [nuxt] A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function. This is probably not a Nuxt bug. Find out more at https://nuxt.com/docs/guide/concepts/auto-imports#vue-and-nuxt-composables. ⁃ at useNuxtApp (C:/Users/.../Documents/GitHub/es-nuxt/nodemodules/.pnpm/[email protected]@[email protected]_@[email protected][email protected][email protected][email protected]__tgdyf4tahfh2p7d7ptjabx7uva/node_modules/nuxt/dist/app/nuxt.js:248:13)...

Clearing UForm errors

I'd like to clear errors from (untouched) fields that had been previously manually set by form.setErrors() in Nuxt UI 2. I tried : ```ts :validate="() => {...

middleware on nested routes

I have an admin/ route with its index.vue page and algo nested routes: admin/users admin/users/[id] I added a middleware in the root admin page but the nested routes don't inherit the middleware...

Set layout in routes

Hello Kapa told me about a legendary appLayout in the nuxt.config.ts but it doesn't seem to exist ```ts routeRules: {...

Failed to fetch urls with sitemap.xml

I am getting the following error when trying to get all valid urls for my webapp. [@nuxtjs/sitemap] Failed to fetch source. { url: 'https://api.kingsburyandpartners.ae/sitemap/urls.json', error: { FetchError: [GET] "https://api.kingsburyandpartners.ae/sitemap/urls.json": <no response> fetch failed...

useRequestFetch does not pass cookie when path is not "/" on ssr

I have a refresh token API in the backend. The refresh token is saved to cookie storage during login with path specific to the refresh token API (e.g. path=/api/refresh-token). However, whenever I try to call this API during SSR in frontend and debug with the backend refresh token API, refresh token value from cookie is always empty. This is how I make a request with useRequestFetch. ```ts...

tests are queued but never run

I am trying to add unit tests but vitest would never actually run the tests. Here are the list of relevant files:
No description

how to send original request from onResponseError?

1. response fails with a 401 2. within onResponseError, perform refresh and get new bearertoken 3. from here, how do i retry my request with the new headers? ive tried.. ```typescript...

Vue Router warning for valid server route

I've a server route configured at /server/routes/images/[...path].get.ts but when called in the frontend, I get these warnings in the terminal:
WARN [Vue Router warn]: No match found for location with path "/images/properties/photos/01JR5W6KCRXZ21CYE4HGTKEEV0"
To be clear, the called URL is a working URL and returns the image correctly in the frontend....

Cannot find 'nuxt.mjs' during build in Dockerfile

Hey all, I'm trying to build my Nuxt application via Docker, but my Dockerfile is giving me the following error: ```...

Nuxt UI 3 useOverlay() not showing modals

Header.vue ```typescript <script setup lang="ts"> import { LoginModal, RegisterModal, SubmitProductModal } from '#components';...

Form with components containing FormInputs

I am using a UForm for a bigger form we have, it has multiple steps which are separated into their own components. Each component is conditionally rendered inside the UForm and they share a common schema and state (the same one that the form uses). my current Idea is to trigger the validation manually once the user presses the next step button but still keep the normal FormInput error display. ...

Nitro URL template

Hi all Is there a way to fetch the URL template from within a nitro event handler? For example, say I have some file /api/book/[id].get.ts....

Deployment to Firebase App Hosting

According to the docs, now the recommended way to deploy Nuxt 3 to Firebase is by using the new Firebase App Hosting (https://nuxt.com/deploy/firebase). In my case it doesn't seem to work. The deployment fails, with Firebase not finding the '/workspace/.output/server/index.mjs' module. I suppose App Hosting doesn't run a yarn build before yarn start or that Nitro's preset has some issues. Anyone made it work successfully? If it's marked as "Recommended" way in the docs I assume it's been tested before and someone can help....

useState not working properly

create a global property to share between routes.

Reached heap limit Allocation failed - JavaScript heap out of memory

Hi, a few days ago I started making some content changes, and after building the site, it never completed the build anymore. Just out of nowhere, the build starts failing. I have tried a lot of solutions on the internet that did not work out unfortunately. I think it has something to do with any package that has updated, however I cannot verify this, or don't know how. What I tried: 1. Tried adding this code block in my nuxt.config.ts (with NODE_ENV set to production)...

Nuxt site deployed on Cloudflare Pages suddenly having issues loading?

My site hosted on Cloudflare pages is suddenly not loading properly. No changes have been made and the last deployment was nearly 30 days ago.
I set up pages rules today thinking redirects are the issue (wasn't using 301 for HTTP -> HTTPS or WWW -> non-WWW). So far it seems iffy if the propagation is loading properly. Once the browser caches, it seems to be okay? But the minute I test in another browser or on mobile I have a loading issue again. Once it finally loads, I get a 404 page. If I clear errors, I can then see the homepage again....