Nuxt

N

Nuxt

Nuxt Community Chat Server

Join

Middleware cant access useCookie on server

Good day everyone, i am trying to use useCookie to store my passport access token then i added middleware to check if the token exist go a head and identify the user if not redirect him to register in it on local windows enviroment every thing work great but when i deployed on the server it always redirect me to register page even my token exist here is my code snipt ``` import { useCookie } from "nuxt/app"; import { useAuthenticationStore } from "../stores/Authentication/authentication"; ...

Nuxt restart always after any change on any folder & files

After each update on a components, my nuxt server restart with log : Directory components/ui/ removed 00:14:44 ℹ Restarting Nuxt... ...

[nitro] Dynamic require of "crypto" is not supported

I'm trying to import a package in api route. ``` import { CodeSandbox } from '@codesandbox/sdk' ...

What is the alternative to passing asset urls as props?

Nuxt does not transform ~/assets/icon.svg if it is used as a prop to a component. What are the workarounds?

Autoimport bug: server/utils not being autoimported

Hello there!, i recently noticed some changes on my nuxt project. My app relies heavily on autoimports from server/utils, but i noticed it's not getting automatically created anymore!. The docs aren't completely clear about this change, and i'm worried for the state of the application. I tried several solutions, updating nuxt3 to the latest version, adding the utils dir to the nuxtconfig file, but none has been successful. I tried generating a new nuxt3 project, and noticed this isn't particular to my original app, the server/utils do not get auto imported anymore. ...

Nuxt instance is unavailable on hot refresh

Hello when i reload a file, all time my app restart for this error : ERROR [unhandledRejection] Nuxt instance is unavailable! 17:01:23
at useNuxt (/C:/Users/antho/Documents/Dev/gemsdrop/dashboard/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/kit/dist/index.mjs:36:11)...

How to to get the current url in NuxtJS 3

How to to get the current url from server-side in NuxtJS 3? ``` import { storeToRefs } from "pinia"; import authApi from "~/composables/api/authApi";...

Typescript error importing vue components in .ts files

Hey, I am having this error in .ts files in a new Nuxt3 project. Don't have any custom setting in tsconfig....
No description

route validation method not called

Hello, I am currently stuck at the validation method on a page in my project. I try to validate the route based on a http request. I tried to return false right away in the validate() method, but still nothing happens. I also can not see console.logs i wrote in that function. Here is my code: ```js definePageMeta({ validate: async (route) => {...

Type errors in Nuxt UI Pro

Hi, there are type errors in the library of NuxtUI pro in the node_modules and its affecting nuxi typecheck and my DX in general, by showing error messages while in development mode with npm run dev. Adding skipLibCheck in nuxt.config.js or tsconfig.json or anywhere doesn't change anything. I don't see anyone else having this issue, yet setting up a nuxt project from scratch and just including nuxt ui pro gives me the same errors without changing anything from the base configs. Has anyone had this issue?...
No description

How to handle error messages based on enviroment?

Hello everyone, has anyone here ever experienced about how we can handle the error message based on environment? so for example if it's on dev, then the message will shown as from the debugging but when it's on production then use a message that looks informative like 'Server is being error now, please try again later'.

How to set ` USlideover` component width?

Hi everyone! I’m working with the USlideover component and trying to adjust its width on smaller screens. Specifically, I want the slider to take about 85% of the screen width on mobile devices. Here’s what I’ve tried so far:...
No description

How to make a middleware Check Permission to access some page

How to make a middleware like Check permission to access some page, so we can send what the roles that can do some action. Something like this I think. ``` definePageMeta({ middleware: ['checkPermission:1']...

Please help me to fix this

I used tailwind css in Nuxt3 project. And tried to use nuxtui npm. B ut when I try to run project. Pre-transform error: Failed to resolve import "#tailwind-config/theme/colors" from "node_modules/@nuxt/ui/dist/runtime/plugins/colors.js?v=07ce98ae". Does the file exist?...

Why nuxt is so slow when refresh it at the second time

Nuxt is so slow when refresh the browser at the second time. Or it's because I have so much dependencies? I only have these dependencies in my project. ``` {...
No description

Multiple slots in a layout?

Is it possible to do multiple slots in a layout? For example, for a page to be able to fill the sidebar's contents. (I don't like teleports because they're not SSR friendly)...

Img src through props.

Following the docs you can use a relative src for the image tag as the following,
~/assets/img/example.png
~/assets/img/example.png
which then nuxt knows that it's a file that it should import in the build step, how can you add support for this kind of image importing in props?

Modal capturing Slideover focus

When I utilize useModal() composable inside of <USlideover />, any modal focus (eg, button clicks) are causing the slideover to close. I can use prevent-close on the slideover, but I like it closing when the user clicks out. Is there a way to control the focus trap, or some other built-in way to have composable-generated modals not close the slideover?...

Nuxt Apollo useAsyncQuery not executing on render

Building a Nuxt3 app with Strapi and Nuxt Apollo, GraphQL endpoint is working. My front and backend is in docker and can communicate and as far as i could understand the GraphQL query was working recently but now it is not fetching data from my endpoint until i manually refetch data in dev console using Payload view. The app is using SSR, is this some kind of hydration problem ? The query is a simple "gql" string and is working in Apollo playground. The data comes in when i manually refresh it b...

Server api nested index.js file is not detected

Hello there, I am quite new with Nuxt and this is my first post here, so I apologise if anything is incorrect! I have done a lot of searching and tried a bunch of solutions suggested by chatGPT without success. I am working on a Nuxt server api, in which I am having a strange problem. Right now I am working on a route, with the following folder structure....