d7c4bc7c8e
- Add allow_forking, allow_merge_commit, allow_rebase_merge, allow_squash_merge fields to repo schemas - Add delete_branch_on_merge field to repository models and schemas - Add has_issues, has_pull_requests, has_wiki, homepage fields to repo schemas - Add topics array field to repository schemas and models - Add restore_token_expires_at and restore_token_hash fields to user schemas - Remove UserAvatarResponse and UploadUserAvatarParams schemas completely - Update CreateRepoParams and UpdateRepoParams with new repository settings - Modify CreateTemplateParams and UpdateTemplateParams with notification template fields - Remove description from SetBranchProtectionParams schema - Delete App.css and auth.css files completely - Update App.tsx with routing migration notes
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { defineConfig, type Plugin } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { resolve } from 'node:path'
|
|
|
|
function spaFallback(): Plugin {
|
|
return {
|
|
name: 'spa-fallback',
|
|
configureServer(server) {
|
|
server.middlewares.use((req, _res, next) => {
|
|
const url = req.url ?? ''
|
|
// Skip API proxy, static files, and Vite internals
|
|
if (url.startsWith('/api') || url.startsWith('/@') || url.startsWith('/node_modules')) {
|
|
return next()
|
|
}
|
|
// If the URL has no file extension, rewrite to index.html
|
|
if (!/\.\w+$/.test(url.split('?')[0])) {
|
|
req.url = '/index.html'
|
|
}
|
|
next()
|
|
})
|
|
},
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss(), spaFallback()],
|
|
resolve: {
|
|
alias: { '@': resolve(__dirname, 'src') },
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|