import { createRouter, createWebHistory } from 'vue-router' const routes = [ { path: '/', name: 'home', component: () => import('./pages/HomePage.vue'), }, { path: '/arena', name: 'arena', component: () => import('./pages/ArenaPage.vue'), }, { path: '/fight-card', name: 'fight-card', component: () => import('./pages/FightCardPage.vue'), }, { path: '/arena/:fightId', name: 'fight', component: () => import('./pages/FightPage.vue'), }, { path: '/leaderboard', name: 'leaderboard', component: () => import('./pages/LeaderboardPage.vue'), }, { path: '/bot/:name', name: 'bot-profile', component: () => import('./pages/BotProfilePage.vue'), }, { path: '/play/:fightId', name: 'human-fight', component: () => import('./pages/HumanFightPage.vue'), }, { path: '/register', name: 'register', component: () => import('./pages/RegisterPage.vue'), }, { path: '/join', name: 'join-bout', component: () => import('./pages/JoinBoutPage.vue'), }, { path: '/schedule', name: 'schedule', component: () => import('./pages/SchedulePage.vue'), }, { path: '/sprites', name: 'sprites', component: () => import('./pages/SpritePreviewPage.vue'), }, { path: '/docs', name: 'docs', component: () => import('./pages/DocsPage.vue'), }, { path: '/soundboard', name: 'soundboard', component: () => import('./pages/SoundboardPage.vue'), }, { path: '/feed', name: 'feed', component: () => import('./pages/FeedPage.vue'), }, { path: '/tournaments', name: 'tournaments', component: () => import('./pages/TournamentListPage.vue'), }, { path: '/tournament/:id', name: 'tournament', component: () => import('./pages/TournamentPage.vue'), }, { path: '/practice', name: 'practice', component: () => import('./pages/PracticePage.vue'), }, { path: '/admin', name: 'admin', component: () => import('./pages/AdminPage.vue'), }, ] export const router = createRouter({ history: createWebHistory(), routes, }) // Handle stale chunk 404s after deploy — force reload to get new assets router.onError((err, to) => { if (err.message.includes('Failed to fetch dynamically imported module') || err.message.includes('Importing a module script failed')) { window.location.assign(to.fullPath) } })