bnason
bnason
Explore posts from servers
NNuxt
Created by bnason on 2/4/2025 in #❓・help
Specify externals in nuxt module
Is it possible to add to the externals array passed to rollup to mark a dependency as external?
8 replies
NNuxt
Created by bnason on 2/3/2025 in #❓・help
Nuxt prepack weird error
I'm getting a weird error when running npm run release in my project. It seems to be coming from npm run prepack but if I run that directly it works fine! It's only as part of the multi command release.
[12:46:04 PM] ERROR Cannot find module /github.com/nasontech/nuxt-fetch-transforms/dist/runtime/github imported from file:///github.com/nasontech/nuxt-fetch-transforms, file:///github.com/nasontech/, file:///github.com/nasontech/nuxt-fetch-transforms/_index.js, file:///github.com/nasontech/node_modules

at _resolve (node_modules/mlly/dist/index.mjs:2102:19)
at resolveSync (node_modules/mlly/dist/index.mjs:2111:10)
at resolvePathSync (node_modules/mlly/dist/index.mjs:2121:24)
at resolvePath (node_modules/mlly/dist/index.mjs:2125:28)
at Object.resolveId (node_modules/@nuxt/module-builder/dist/chunks/build.mjs:108:40)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
at async resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24117:26)
at async ModuleLoader.resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24531:15)
at async Object.resolveId (node_modules/unbuild/node_modules/@rollup/plugin-commonjs/dist/es/index.js:588:10)
[12:46:04 PM] ERROR Cannot find module /github.com/nasontech/nuxt-fetch-transforms/dist/runtime/github imported from file:///github.com/nasontech/nuxt-fetch-transforms, file:///github.com/nasontech/, file:///github.com/nasontech/nuxt-fetch-transforms/_index.js, file:///github.com/nasontech/node_modules

at _resolve (node_modules/mlly/dist/index.mjs:2102:19)
at resolveSync (node_modules/mlly/dist/index.mjs:2111:10)
at resolvePathSync (node_modules/mlly/dist/index.mjs:2121:24)
at resolvePath (node_modules/mlly/dist/index.mjs:2125:28)
at Object.resolveId (node_modules/@nuxt/module-builder/dist/chunks/build.mjs:108:40)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
at async resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24117:26)
at async ModuleLoader.resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24531:15)
at async Object.resolveId (node_modules/unbuild/node_modules/@rollup/plugin-commonjs/dist/es/index.js:588:10)
6 replies
NNuxt
Created by bnason on 2/2/2025 in #❓・help
Module dependencies as dev only
Can my module dependencies that are only used in the main defineNuxtModule file be dev only? My module just generates a basically static (no imports) template in the buildDir and defines an auto import for that file
4 replies
NNuxt
Created by bnason on 1/31/2025 in #❓・help
Get app version
Is there a good/official way to get the version of the Nuxt app? I suppose this would be pulled from package.json and git. So if I build the app with version v1.0.0 in package.json but the git tag isn't v1.0.0, I'd want the web page to show version "v1.0.0-DEV" or something to indicate it's not an actual release
9 replies
NNuxt
Created by bnason on 1/26/2025 in #❓・help
Accessing headers when using $fetch
Is it possible to access the raw response to get the headers using $fetch?
12 replies
NNuxt
Created by bnason on 1/21/2025 in #❓・help
Access InternalApi in module build
Is it possible to access the InternalApi in a module during the build process?
5 replies
NNuxt
Created by bnason on 1/21/2025 in #❓・help
"Simpler" date conversion from API without using a special formatter like SuperJSON?
Does anyone know of a tool/module/whatever that could be naturally parse api responses back into their native data types? For instance, Dates get converted to string for serialization but not back on the client side. I've used SuperJSON previously to handle the conversion, but that also makes debugging less enjoyable since now all the api responses are encoded in its format which just creates a lot of noise.
29 replies
NNuxt
Created by bnason on 1/21/2025 in #❓・help
Nuxt Server Api response data typing with parameters
Is there any way to get a narrowed down type when calling a GET request with parameters? For instance, If I call useFetch(`/api/user/${userId}`) it'll give me the base object and if I want to include extra data like their posts I would call useFetch(`/api/user/${userId}`, { query: { includePosts: true }) and I want that response to be typed to include the includePosts key and that it exists
5 replies
NNuxt
Created by bnason on 1/6/2025 in #❓・help
Server side dynamic import
Is there a way use await import(....) on the server side? I've tried importing the full path with and without the extension and both give errors. Using .ts says unknown file extension .ts and without ext, says Cannot find module. I tried using the relative path, IE ~~/server/utils/foo/bar but that says cannot find module ~~. I'm not loading a nitro plugin or module, just a normal ts file with an export I'm checking for once loaded.
14 replies
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