bnason
bnason
Explore posts from servers
NNuxt
Created by bnason on 12/10/2024 in #❓・help
NuxtPage default page
Is it possible to define the "default" page within a page in the app/pages folder and also have a <NuxtPage /> to render children? I don't want to create a bunch of index.vue files in the children folders
19 replies
NNuxt
Created by bnason on 12/9/2024 in #❓・help
`#shared` types. Failed to resolve extends base type.
I'm trying to use the new #shared functionality and have a ./shared/types/Budget.ts file that exports multiple interfaces. I can successfully use them automatically in my code and VSCode knows about them. However, when I run the nuxt app, I get Internal server error: [@vue/compiler-sfc] Failed to resolve extends base type.
10 replies
NNuxt
Created by bnason on 12/8/2024 in #❓・help
NuxtLink active boolean
Is there any way to get the NuxtLinks active status as a value in the links scope? Example <NuxtLink to="/settings"><MyCustomButton :selected="?????" /></NuxtLink>
13 replies
NNuxt
Created by bnason on 12/4/2024 in #❓・help
Cannot access before initialization
I have a few custom nitro aliases setup:
nuxt.hook('nitro:config', (nitroConfig) => {
if (!nitroConfig.alias) return

nitroConfig.alias['#queue-handlers'] = resolve('./runtime/server/handlers')
nitroConfig.alias['#queue'] = resoleServer('./queues')
nitroConfig.alias['#cron'] = resolve('./runtime/server/queues/cron')
})
nuxt.hook('nitro:config', (nitroConfig) => {
if (!nitroConfig.alias) return

nitroConfig.alias['#queue-handlers'] = resolve('./runtime/server/handlers')
nitroConfig.alias['#queue'] = resoleServer('./queues')
nitroConfig.alias['#cron'] = resolve('./runtime/server/queues/cron')
})
My cron source file imports import { defineQueue } from '#queue-handlers' but this is giving me the following error: ERROR [nitro] [uncaughtException] Cannot access 'defineQueue' before initialization It seems like some sort of registration timing or order but I can't see what.
5 replies
NNuxt
Created by bnason on 12/4/2024 in #❓・help
Auto import utils in server recursively
I'm able to get auto import for recursive files working in the app dir, but I don't see any way to do it for the server dir.
10 replies
NNuxt
Created by bnason on 12/4/2024 in #❓・help
Setting cookie with sendRedirect
I'm having a weird error where I can't make a simple replication for it seems. I am logging in a user and setting their session via useSession then I am redirecting them back to where they came from using sendRedirect. However that results in their session NOT being set. If I simply comment out the sendRedirect everything works fine though.
5 replies
NNuxt
Created by bnason on 11/18/2024 in #❓・help
Failed to resolve import "#tailwind-config"
The Nuxt TailwindCSS module docs state I can use import tailwindConfig from '#tailwind-config'. However, I get the following error when trying that: Failed to resolve import "#tailwind-config" Does anyone have any idea
4 replies
NNuxt
Created by bnason on 11/1/2024 in #❓・help
Nuxt Devtools not working
When I open up the Nuxt Devtools I get a 404 error Page not found: /__nuxt_devtools__/client/ This is on a pretty much brand new project.
7 replies
NNuxt
Created by bnason on 10/23/2024 in #❓・help
AsyncLocalStorage server side
I've been looking at the documentation for the experimental feature asyncContext. I'm confused if this is a client side only feature or if it's supposed to work server side to? My understanding was AsyncLocalStorage was on the node side, not the browser side. I'm trying to use it in a server side util to get some data from the db with the logged in user information but useNuxtApp is undefined there. I'm not exactly sure what to use. I'm calling this from a defineEventHandler api route which I thought it should work in.
5 replies
NNuxt
Created by bnason on 10/23/2024 in #❓・help
Reference assets with domain name
Is it possible to configure Nuxt to reference assets (images, js and css) with the full URL including the domain?
6 replies
CDCloudflare Developers
Created by bnason on 10/22/2024 in #general-help
Serve url on any subdomain
I have an app deployed at https://foo.example.com/__debug and I would like to have all urls that match /_debug/* on ANY of our subdomains (IE bar.example.com, baz.example) to be routed behind the scenes (NOT redirected) to that url. For instance, if someone goes to https://bar.example.com/__debug/cookies I want Cloudflare to basically change the backend to the foo.example.com ip and served the page really at https://foo.example.com/__debug/cookies If I were doing this in HAProxy, I would create an acl acl debug ^\/__debug/.* with use_backend foo if debug
9 replies
NNuxt
Created by bnason on 10/17/2024 in #❓・help
[vite-node] [plugin:vite:vue]
I seem to be randomly getting the following error and I have no idea how to debug this. The component it's referencing is definitely NOT producing the error (It's from shadcn-vue)
ERROR [vite-node] [plugin:vite:vue] [VITE_ERROR] /components/ui/tabs/Tabs.vue <br><pre>&lt;script setup lang="ts"&gt;
import { TabsRoot, useForwardPropsEmits } from 'radix-vue'
import type { TabsRootEmits, TabsRootProps } from 'radix-vue'`
...
ERROR [vite-node] [plugin:vite:vue] [VITE_ERROR] /components/ui/tabs/Tabs.vue <br><pre>&lt;script setup lang="ts"&gt;
import { TabsRoot, useForwardPropsEmits } from 'radix-vue'
import type { TabsRootEmits, TabsRootProps } from 'radix-vue'`
...
1 replies
NNuxt
Created by bnason on 10/16/2024 in #❓・help
Shared types/utils
There appears to be work on a common shared folder that can be imported/auto-imported via both Vue and the server at https://github.com/nuxt/nuxt/issues/28675 Is there a way to achieve this now in Nuxt3 by just updating my config? I understand the full implementation of this feature will have guards in place, but I just need a simple single location that is auto imported on both sides.
2 replies
NNuxt
Created by bnason on 8/29/2024 in #❓・help
Load config from database at runtime start
Is it possible to load module configuration from a database at runtime?
1 replies
NNuxt
Created by bnason on 8/26/2024 in #❓・help
Auto import types
How can I get types in my root types folder to be auto imported? I've tried both adding it to the nuxt imports.dirs config array as well as the nuxt config typescript.tsConfig.include array
5 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
Is there any to have server/utils/** auto imported in the server side? I've tried to modify the nuxt config imports.dir as well as creating a custom module that calls addServerImportsDir but neither seem to have an effect.
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Fetch load time
Is there any way to get the time useFetch took to load the data?
5 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
useLogger from `@nuxt/kit` on server side
I'm trying to use useLogger from @nuxt/kit in a server side util, but I get the following:
This module cannot be importedd in server runtime. [importing @nuxt/kit from server/utils/oracle.ts]

RollupError: server/utils/oracle.ts (6:0): "useLogger" is not exported by "node_modules/unenv/runtime/mock/proxy.mjs", "imported by "server/utils/oracle.ts"
This module cannot be importedd in server runtime. [importing @nuxt/kit from server/utils/oracle.ts]

RollupError: server/utils/oracle.ts (6:0): "useLogger" is not exported by "node_modules/unenv/runtime/mock/proxy.mjs", "imported by "server/utils/oracle.ts"
Is it ONLY available in a nuxt module? Thats what the docs show as its usage. Is the setup of a nuxt module not done server side?
6 replies
NNuxt
Created by bnason on 8/15/2024 in #❓・help
Using fetch in composable with shared results
I have a vue composable that loads an api endpoint and I want any call to my useFooData composable to return the same useFetch results so if someone calls the clear or refresh methods it appies everywhere.
2 replies
NNuxt
Created by bnason on 8/14/2024 in #❓・help
Cannot find name 'defineNuxtConfig'
I have no why this all of a sudden started happening. I'm getting this error in my nuxt.config.ts Cannot find name 'defineNuxtConfig'. Did you mean 'defineNitroConfig'? I'm running the dev server. I've tried deleting the .nuxt and then running dev server again. I've restarted vscode as well as restarted the ts server.
5 replies