bnason
bnason
Explore posts from servers
NNuxt
Created by bnason on 11/1/2024 in #❓・help
Nuxt Devtools not working
Hmm I think it has to do with @vite-pwa/nuxt
7 replies
NNuxt
Created by bnason on 11/1/2024 in #❓・help
Nuxt Devtools not working
That did not resolve the isssue
7 replies
NNuxt
Created by bnason on 10/23/2024 in #❓・help
Reference assets with domain name
This is what I came up with: ~~/server/plugins/meta-base.ts
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html, { event }) => {
html.head.unshift(`<base href="https://foo.example.com/" />`)
})
})
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html, { event }) => {
html.head.unshift(`<base href="https://foo.example.com/" />`)
})
})
6 replies
NNuxt
Created by bnason on 10/16/2024 in #❓・help
Shared types/utils
So far, I've gotten this so far which works for everything except types in *.d.ts files
nitro: {
imports: {
dirs: ['./shared/types', './shared/utils'],
},
},
imports: {
dirs: ['../shared/types/**', '../shared/utils/**'],
},
nitro: {
imports: {
dirs: ['./shared/types', './shared/utils'],
},
},
imports: {
dirs: ['../shared/types/**', '../shared/utils/**'],
},
2 replies
NNuxt
Created by bnason on 8/26/2024 in #❓・help
Auto import types
So I have a file ./typess/common.d.ts and in it I have type FooBar = { foo: string, bar: number } but FooBar is not defined in any of my source files
5 replies
NNuxt
Created by bnason on 8/26/2024 in #❓・help
Auto import types
I have my common.d.ts which exports an interface. If I use declare interface instead is that the correct way?
5 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
yea i just have the dumb apparently. I was putting a client composable in the server utils ... all I can say is its friday...
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
grr im on a call and working on multiple things and got them mixed up, 1 sec let me get organized real quick lol
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
im wonddering if there is some hidden error? I'm not getting anything in build or vscode
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
this is whats in my file
import { useFetch } from 'nuxt/app'
import { ref } from 'vue'

export const useFetchTime = () => {
const start = ref<DOMHighResTimeStamp | undefined>()
const time = ref<number | undefined>()

const fetchOptions: Pick<NonNullable<Parameters<typeof useFetch>[1]>, 'onRequest' | 'onResponse'> = {
onRequest({ request, options }) {
start.value = performance.now()
},
onResponse({ request, response, options }) {
const now = performance.now()
if (start.value) {
time.value = start.value - now
}
},
}

return { start, time, fetchOptions }
}
import { useFetch } from 'nuxt/app'
import { ref } from 'vue'

export const useFetchTime = () => {
const start = ref<DOMHighResTimeStamp | undefined>()
const time = ref<number | undefined>()

const fetchOptions: Pick<NonNullable<Parameters<typeof useFetch>[1]>, 'onRequest' | 'onResponse'> = {
onRequest({ request, options }) {
start.value = performance.now()
},
onResponse({ request, response, options }) {
const now = performance.now()
if (start.value) {
time.value = start.value - now
}
},
}

return { start, time, fetchOptions }
}
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
useFetchTime.ts and yes, export const useFetchTime => ...
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
Yea I get a 500 error when trying to use the function exported from a file in my ~/server/utils dir
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
hmm, no it does not auto import, let me try to remove my custom imports dir setting and module and double check
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
Yea I've looked at that, as far as I can tell it doesn't say anything about importing for the utils ddir
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Fetch load time
Mostly I was wondering if there was some underlying fetch result that might include that already
5 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Fetch load time
I'm actually constantly refreshing, so I've found that there are onRequest andd onResponse options I can pass to it where I'm basically ddoing thhe same thing
5 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
useLogger from `@nuxt/kit` on server side
I wish nuxt had a more unified logging solution, especially for server side logs. I eventually want to start shipping them into our ELK stack.
6 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
useLogger from `@nuxt/kit` on server side
I guess thaat it only being available for modules make sense since that is what nuxt kit is for
6 replies
NNuxt
Created by bnason on 8/15/2024 in #❓・help
Using fetch in composable with shared results
Or does it handle this stuff behind the scene?
2 replies
NNuxt
Created by bnason on 8/14/2024 in #❓・help
Cannot find name 'defineNuxtConfig'
I ended up doing that, and cleaning up a bunch of stuff and it finally went away. No idea exactly what did it though.
5 replies