Nuxt

N

Nuxt

Nuxt Community Chat Server

Join

NuxtImg from assets folder

Hey everyone! I recently made two changes to my Nuxt 3 project: - Switched from @nuxt/image-edge to @nuxt/image - Moved from Webpack to Vite...

Websocket topic publish doesn't work until you refresh the page

I have followed along with this example here that @Jacek (sorry for tagging you) had created back in October and have websockets mostly working. However, what I have found is that when I try and publish to a specific topic that it won't send the message until after you refresh the page. In the linked example above, you can see this happen where if you just go into the project and the chat loads on the right, it won't ever broadcast the publish that is supposed to be going on every couple of seconds until you click the refresh icon above the chat and suddenly you are User #2 and the publish messages come in. So...I'm asking for help in understanding if there is something wrong with my code and the example code at the link or if there is some sort of bug going on with the underlying websocket system as it currently stands in Nitro?...

NuxtHub - useRuntimeConfig not working as expected in server middleware

useRuntimeConfig is returning config defaults instead of env overrides (cloudflare/nuxthub) when called in a middleware in server/middleware. Also breaks useRuntimeConfig calls in normal server routes if useRuntimeConfig is called anywhere in a middlewhere. What am I not understanding?

Authentication and Fetch Confusion

Hello everyone, im new to nuxt, i developed most of my projects on vite but i am kind of getting confused about the fetch function, i want to contact my backend service for authentication but i am having a problem when i submit the form i am using $fetch function to my localhost at a different port where the backend service is listening but i don't understand why it maps the IP to a page instead....
No description

How to show hydration mismatch errors causes in production builds?

As per title, how to show hydration mismatch errors causes in production builds? I am running into an issue where i get no hydration errors in dev but as soon as i make a prod build they show up and i need to figure out why.

Disable Prefetch/Preload in dev mode on Nuxt Bridge

Hi there, does anyone know of a way to disable the prefetch/preload behavior during development while being on nuxt-bridge? I managed to disable it in production in the final build by adding a module with the following code: ``` import { defineNuxtModule } from '@nuxt/kit'...

Package import specifier "#build/nuxt.config.mjs" is not defined in package

Hey. I'm getting this error when using a specific package, but the error is not pointing to that package specifically, but I'm guessing a dependency of that package. Is there something I can do to resolve this issue? ``` [nuxt] [request error] [unhandled] [500] Package import specifier "#build/nuxt.config.mjs" is not defined in package...

Server read data from public

Hello, In server/api I have data script, that reads file from public, and returns json ```ts import fs from 'fs'; import {parse} from 'smol-toml';...

How to clear cache for routeRules

Hi, I'm running Nuxt 3.15.2. I added this redirect to my nuxt.config.ts file. It redirects to a server route. ``` routeRules: { "//logout": { redirect: { to: "//auth/logout", statusCode: 308 } }...

i18n multiple files for each language

Hello, I would like to split my translations into several translations files to have them by page. I found this, the second answer (rated 1) looks good enough for me :...

Middlewares run before plugins are initialized?

Hey everyone. We're having a lot of trouble with our Nuxt instance, where seemigly middlewares can be running before plugins are fully initialized. Which in our case breaks pinia stores that are accessed in middlewares and other strange things. I even found this rather new bug report from someone else on https://github.com/nuxt/nuxt/issues/30824 Any ideas on this? Might this be a nuxt-internal bug?...
No description

Hydration Error with useAsyncData

Hey, I am running code like this: ...

Setting up a static multi page app

I can't find many resources on how exactly you should structure/develop an MPA with nuxt. I do not want to use vue-router or anything like that, and I want each endpoint of my site to end up as a static page as well. I'm currently stuck on how to render an endpoint (which I put at pages/index.html) at / on the dev server, but I don't know if I should use the pages folder at all if I'm not using the router.

Hosting Nuxt 3 Server API on Cloudflare: Pages, Workers, or Neither?

I built a simple API in the server directory of my Nuxt 3 project. The structure looks like this: ```// server/api/hello.ts export default defineEventHandler((event) => { return { hello: 'world'...

Type checking module with conditional imports

I have a module that conditionally calls addImports, depending on the Nuxt configuration. Type checking fails unless a configuration is passed that results in all those conditional addImport being executed. For example some plugins (that are also conditionally added using addPlugin) use imports that may not be present, so vue-tsc will fail. What's the normal way of getting around this so type checking can pass regardless of config?...

Excessive CSS in Nuxt3 with Tailwind: Unexpected Unused Styles

Hello everyone, I'm working on a project using Nuxt3 and Tailwind CSS. Everything is running smoothly, but I've noticed that the generated source code includes a very large amount of CSS. It seems that all of Tailwind's styles are being loaded instead of only the ones I'm using. Is this the expected behavior, or might I have misconfigured something? So I would like to know if the style in source code of this size in production is expected?...

TypeScript auto-import errors

How do I make TypeScript ignore the auto-imports?

Specify externals in nuxt module

Is it possible to add to the externals array passed to rollup to mark a dependency as external?

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 ...
Next