Files
hnh-map/frontend-nuxt/README.md
Nikolay Tatarinov 47b81c8f22 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.
2026-03-04 00:35:15 +03:00

69 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# HnH Map Nuxt 4 frontend
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`).
## Project structure
- **pages/** — route pages (e.g. map view, profile, login)
- **components/** — Vue components
- **composables/** — shared composition functions
- **layouts/** — layout components
- **server/** — Nitro server (if used)
- **plugins/** — Nuxt plugins
- **public/gfx/** — static assets (sprites, terrain, etc.)
## Requirements
- **Node.js 20+** (required for build; `engines` in package.json). Use `nvm use` if you have `.nvmrc`, or build via Docker (see below).
- npm
## Setup
```bash
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
npm run dev
```
Then open the app at the path shown (e.g. `http://localhost:3000/map/`). Ensure the Go backend is running and proxying or serving this app if needed.
## Build
```bash
npm run build
```
Static export (for Go `http.Dir`):
```bash
npm run generate
```
Output is in `.output/public`. To serve from the existing `frontend` directory, copy contents to `../frontend` after generate, or set `nitro.output.dir` in `nuxt.config.ts` and build from the repo root.
## Build with Docker (Node 20)
Build requires Node 20+. If your host has an older version (e.g. Node 18), build the frontend in Docker:
```bash
docker build -t frontend-nuxt .
docker create --name fn frontend-nuxt
docker cp fn:/frontend ./output-public
docker rm fn
# Copy output-public/* into repo frontend/ and run Go server
```
## Cutover from Vue 2 frontend
1. Build this app (`npm run generate`).
2. Copy `.output/public/*` into the repos `frontend` directory (or point Go at the Nuxt output directory).
3. Restart the Go server. The same `/map/` routes and API remain.