45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|
import { paraglideVitePlugin } from '@inlang/paraglide-js'
|
|
import path from 'node:path'
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
// Compile messages/*.json → src/paraglide so `m`/`mKey` resolve, with HMR on
|
|
// message edits. Must run first.
|
|
paraglideVitePlugin({ project: './project.inlang', outdir: './src/paraglide' }),
|
|
tanstackStart({
|
|
router: {
|
|
routesDirectory: path.resolve(import.meta.dirname, 'src/pages'),
|
|
generatedRouteTree: path.resolve(import.meta.dirname, 'src/routeTree.gen.ts'),
|
|
routeFileIgnorePrefix: '-',
|
|
quoteStyle: 'single',
|
|
},
|
|
}),
|
|
react(),
|
|
],
|
|
server: {
|
|
port: 6001,
|
|
host: '0.0.0.0',
|
|
// The standalone Pikku backend serves better-auth under /api/auth but data
|
|
// RPC + REST routes at the root (/rpc, /users, …). The app calls both under
|
|
// a single /api base, so strip /api for everything except /api/auth. Keeping
|
|
// it same-origin (via this proxy) means no CORS and better-auth sees a
|
|
// consistent Origin. Backend URL overridable for e2e via VITE_BACKEND_URL.
|
|
proxy: {
|
|
'/api/auth': process.env.VITE_BACKEND_URL || 'http://localhost:6002',
|
|
'/api': {
|
|
target: process.env.VITE_BACKEND_URL || 'http://localhost:6002',
|
|
rewrite: (p) => p.replace(/^\/api/, ''),
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
dedupe: ['react', 'react-dom'],
|
|
alias: {
|
|
'@': path.resolve(import.meta.dirname, 'src'),
|
|
},
|
|
},
|
|
})
|