Nuxt

N

Nuxt

Nuxt Community Chat Server

Join

middleware

I created a middleware in which I send an api request and validate the JWT token. In the vue app I have a token download from the serwer. App.vue ```<script setup> const { useAccessToken } = useAuth();...

Vitest times out when mocking the Router

Hey, I'm currently trying to mock useRouter().push(), but unfortunately, Vitest (the mountSuspended function) times out. ```ts // Some stuff const mockRouterPush = vi.fn();...

Tailwind works, but doesn't show suggestions (intellisense) in a Nuxt project

Here's the relevant content inside the tailwind config file: ```js export default { content: [ "./components/*/.{js,vue,ts}",...

v-bind not unwrapping reactive properties from composable

I have a helper composable here for orchestrating common aria attributes for form fields. ```typescript export function useFieldControl(args: UseFieldControlArgs): UseFieldControlReturn { const fieldId = args.id || useId();...

Generating thumbnails of site

Hello, I am porting my site from VitePress to Nuxt3 because I need some serverside stuff Nuxt provides. I can't find an appropriate hook to use when the site could be temporarily hosted and opened to take a screenshot to generate a page's thumbnail. I am thinking one of thoes might work? build:done builder:generateApp...

Question about image tag and svgs in production

Hello I am working in Nuxt3 and am fairly new to web dev and very new to Nuxt3 I am trying to learn how to properly use a svg that will work in production. Here is the code that was in my page before moving to a component, it worked in dev and production ```html <span...

How do you make component tests in Nuxt 3?

Guys how do you make visual component tests in Nuxt 3?

Usefetch doesnt work when using middleware

Hi, I have a problem. If I use middleware (even if it is empty), my usefetch does not work during ssr. It does get the data, but it doesn't pass it to the client.

Trouble with multiple pinia actions inside useAsyncData

I want to fetch a bunch of paginated data on pageload, so I use useAsyncData to avoid dupe requests. I get that you're not really meant to use useAsyncData for side-effects but since it's the only mechanism I know of that prevents duplicate fetches, it's what I got. The problem is, when I generate an array of requests to pass into a Promise, the function stalls. It's not that the reqs array is undefined - it's that nothing runs past it inside that function. asyncData simply returns null before ever reaching the Promise. ```...

Sanity Navigation Error: TypeError: can't access property

Hi! I'm using Sanity in my project but I'm facing an issue with navigation. When selecting a project I initially get an error: Uncaught (in promise) TypeError: can't access property 0, $setup.project is null. However clicking the project again successfully navigates to it On the project page I am completely stuck and can't navigate the same error appears in console and I need to do a hard refresh to proceed. I'm using a simple groq query. ...
No description

I don't want timeout to pause on hover for nuxt ui toast

currently i do the below ```ts toast.add({ title: 'Signing out!', color: 'orange',...

Fresh project with nuxt ui pro and pnpm

I am getting ERROR Named export 'compile' not found. The requested module 'tailwindcss' is a CommonJS module, which may not support all module.exports as named exports. on a monorepo with nuxt 3 & nuxt ui 3. Not sure what the cause is of this. Can anyone provide some guidance? ```{...

Global $fetch hooks

Is it possible to globally define hooks for onRequest and onResponseError (apart from having to create a custom useFetch and use that everywhere)?

Working with types and modules

How do I work with types. The docs said that everything is auto imported and types even auto generated, whatever that means, I didn't understand from the docs. Just imported first module and nothing works, beside no errors and nothing appearing the module is not recognize and i can't find in the whole docs a solution how will this can be configured. Says it's working by default
No description

Testing `import.meta.client` and/or `import.meta.server`

Basically, this: https://github.com/nuxt/test-utils/discussions/884 For me, its a soft-blocker to move from process.client to import.meta.client...

How-to set a response header in the server route

I'd like to know how to explicitly set a header in response to a server route. Specifically, I'd like to set the Content-Type of the returned data. This question specifically relates to /server routes. I understand it's possible to set the HTTP response status code using setResponseStatus(event, 202). However, I can't find any details on setting the response headers....

Launch command build and falls during Nuxt Nitro server

`<--- Last few GCs ---> [23471:0x7fef53300000] 178952 ms: Scavenge 2017.5 (2066.1) -> 2017.2 (2077.1) MB, 7.45 / 0.00 ms (average mu = 0.458, current mu = 0.278) allocation failure; [23471:0x7fef53300000] 178968 ms: Scavenge 2024.7 (2077.4) -> 2024.9 (2077.9) MB, 7.16 / 0.00 ms (average mu = 0.458, current mu = 0.278) allocation failure; [23471:0x7fef53300000] 180278 ms: Scavenge 2025.5 (2077.9) -> 2024.6 (2099.9) MB, 1309.32 / 0.00 ms (average mu = 0.458, current mu = 0.278) allocation failure; ...

How do i prevent useCookie from doing stuff on SSR?

Hi! Is it possible to make useCookie only run on the client?

Google Storage Bucket Integration

Is there a way to integrate Google's storage buckets as a file storage in nuxt 3?

Custom route roules

Is possible to do something like this to intercept all the xml routes? With this code seems not work 😦 `routeRules: { "**.xml": { proxy: {...
Next