Environment:4thfever Cultivation world simulator Frontend Build Environment
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Build |
| Last Updated | 2026-10-22 16:00 GMT |
Overview
Node.js build environment with Vite, Vue 3, TypeScript, Pixi.js, and Naive UI for the cultivation world simulator web frontend.
Description
This environment provides the toolchain for building and developing the web frontend. It uses Vite 5 as the build tool with Vue 3 SFC support, TypeScript 5.9 for type checking, Pixi.js 8 for canvas-based map rendering, and Naive UI as the component library. The frontend communicates with the backend via REST API and WebSocket. Playwright is included for E2E smoke tests, and Vitest for unit tests.
Usage
Use this environment for frontend development (`npm run dev`), production builds (`npm run build`), type checking (`npm run type-check`), and running frontend tests (`npm run test`). It is required for any Implementation that touches the web frontend.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, Windows, or macOS | Cross-platform |
| Node.js | 18+ (recommended 20+) | Required by Vite 5 |
| npm | 9+ | For lockfile compatibility |
| Disk | 500MB+ for node_modules | Pixi.js and Naive UI are large |
Dependencies
Runtime Dependencies
- `vue-i18n` ^9.14.5 — Internationalization
- `pinia` ^3.0.4 — State management
- `naive-ui` ^2.43.2 — UI component library
- `pixi.js` ^8.14.2 — Canvas rendering for game map
- `pixi-viewport` ^6.0.3 — Map pan/zoom
- `vue3-pixi` ^1.0.0-beta.3 — Vue 3 Pixi integration
- `@vueuse/core` ^14.0.0 — Vue composition utilities
- `vfonts` ^0.0.3 — Font loading
Build & Dev Dependencies
- `vite` ^5.4.21 — Build tool and dev server
- `typescript` ~5.9.3 — Type checking
- `sass` ^1.94.1 — SCSS compilation
- `@vitejs/plugin-vue` ^5.2.4 — Vue SFC support
- `vitest` ^2.1.8 — Unit test runner
- `@vitest/coverage-v8` ^2.1.8 — Coverage
- `@vue/test-utils` ^2.4.6 — Vue testing utilities
- `@testing-library/vue` ^8.1.0 — DOM testing
- `jsdom` ^25.0.1 — DOM simulation for tests
- `msw` ^2.7.0 — API mocking
- `@playwright/test` ^1.59.1 — E2E smoke tests
Credentials
No credentials required for the frontend build environment. The frontend receives all configuration from the backend API and never stores API keys client-side.
Quick Install
cd web
npm install
npm run dev # Development server
npm run build # Production build
npm run type-check # Type checking only
npm run test # Unit tests
Code Evidence
NPM manifest from `web/package.json:1-41`:
{
"name": "web",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"test": "vitest run",
"type-check": "tsc --noEmit"
},
"dependencies": {
"naive-ui": "^2.43.2",
"pinia": "^3.0.4",
"pixi.js": "^8.14.2",
"vue-i18n": "^9.14.5"
}
}
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Cannot find module 'pixi.js'` | Dependencies not installed | `cd web && npm install` |
| TypeScript errors on `npm run build` | Type mismatches | Run `npm run type-check` to identify |
| Vite dev proxy fails | Backend not running or wrong port | Check `VITE_API_TARGET` env var |
Compatibility Notes
- Vite dev proxy: In dev mode, the backend sets `VITE_API_TARGET` and `VITE_WS_TARGET` environment variables automatically via `bootstrap.py`.
- Pixi.js: Large objects (sprites, textures) must use `shallowRef` — deep reactivity on Pixi objects causes performance issues.
- BASE_URL: Static assets in `public/` must be referenced via `import.meta.env.BASE_URL` helper, not hardcoded `/` paths.