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.
This commit is contained in:
2026-03-04 00:35:15 +03:00
parent 8f769543f4
commit 47b81c8f22
4 changed files with 6 additions and 5 deletions

View File

@@ -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`). 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 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 ## Development
```bash ```bash

View File

@@ -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) // 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: { nitro: {
devProxy: { devProxy: {
'/map/api': { target: 'http://backend:3080/map/api', changeOrigin: true }, '/map/api': { target: 'http://backend:3080/map/api', changeOrigin: true },

View File

@@ -20,7 +20,7 @@
"dependencies": { "dependencies": {
"leaflet": "^1.9.4", "leaflet": "^1.9.4",
"md5": "^2.3.0", "md5": "^2.3.0",
"nuxt": "^3.21.1", "nuxt": "^4.3.1",
"vue": "^3.5.13", "vue": "^3.5.13",
"vue-router": "^4.5.0" "vue-router": "^4.5.0"
}, },

View File

@@ -7,6 +7,6 @@ export default defineEventHandler((event) => {
try { try {
decodeURI(path) decodeURI(path)
} catch { } catch {
throw createError({ statusCode: 400, statusMessage: 'Bad Request' }) throw createError({ status: 400, statusText: 'Bad Request' })
} }
}) })