From 47b81c8f221f3974f3d0176dc625b6baa56025d5 Mon Sep 17 00:00:00 2001 From: Nikolay Tatarinov Date: Wed, 4 Mar 2026 00:35:15 +0300 Subject: [PATCH] Upgrade Nuxt version and update configuration - Updated Nuxt from version 3.21.1 to 4.3.1 in package.json for improved features and performance. - Removed outdated TypeScript error suppression in nuxt.config.ts for cleaner code. - Updated README.md to reflect the transition to Nuxt 4 and added instructions for post-upgrade steps. - Modified error handling in middleware to use consistent error property names. --- frontend-nuxt/README.md | 6 ++++-- frontend-nuxt/nuxt.config.ts | 1 - frontend-nuxt/package.json | 2 +- frontend-nuxt/server/middleware/0.uri-guard.ts | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend-nuxt/README.md b/frontend-nuxt/README.md index 3e0f4d7..8fc9a2c 100644 --- a/frontend-nuxt/README.md +++ b/frontend-nuxt/README.md @@ -1,6 +1,6 @@ -# HnH Map – Nuxt 3 frontend +# HnH Map – Nuxt 4 frontend -Nuxt 3 + Tailwind + DaisyUI frontend for the HnH map. Served by the Go backend under `/map/`. +Nuxt 4 + Tailwind + DaisyUI frontend for the HnH map. Served by the Go backend under `/map/`. In dev mode the app is available at the path with baseURL **`/map/`** (e.g. `http://localhost:3000/map/`). The Go backend must be reachable (directly or via the dev proxy in `nuxt.config.ts`). @@ -25,6 +25,8 @@ In dev mode the app is available at the path with baseURL **`/map/`** (e.g. `htt npm install ``` +After upgrading the repo (e.g. to Nuxt 4), run `npm install` in this directory, then `npx nuxt prepare`, and verify with `npm run build` and `npm run test`. + ## Development ```bash diff --git a/frontend-nuxt/nuxt.config.ts b/frontend-nuxt/nuxt.config.ts index 33ebe7c..1d73579 100644 --- a/frontend-nuxt/nuxt.config.ts +++ b/frontend-nuxt/nuxt.config.ts @@ -39,7 +39,6 @@ export default defineNuxtConfig({ }, // Dev: proxy /map API, SSE and grids to Go backend (e.g. docker compose -f docker-compose.dev.yml) - // @ts-expect-error nitro types lag behind Nuxt compat v4 nitro: { devProxy: { '/map/api': { target: 'http://backend:3080/map/api', changeOrigin: true }, diff --git a/frontend-nuxt/package.json b/frontend-nuxt/package.json index c64f3ea..58c4b84 100644 --- a/frontend-nuxt/package.json +++ b/frontend-nuxt/package.json @@ -20,7 +20,7 @@ "dependencies": { "leaflet": "^1.9.4", "md5": "^2.3.0", - "nuxt": "^3.21.1", + "nuxt": "^4.3.1", "vue": "^3.5.13", "vue-router": "^4.5.0" }, diff --git a/frontend-nuxt/server/middleware/0.uri-guard.ts b/frontend-nuxt/server/middleware/0.uri-guard.ts index 0faac37..ab0a439 100644 --- a/frontend-nuxt/server/middleware/0.uri-guard.ts +++ b/frontend-nuxt/server/middleware/0.uri-guard.ts @@ -7,6 +7,6 @@ export default defineEventHandler((event) => { try { decodeURI(path) } catch { - throw createError({ statusCode: 400, statusMessage: 'Bad Request' }) + throw createError({ status: 400, statusText: 'Bad Request' }) } })