Files
e2e 36f1b746bd
Some checks failed
Main / Setup and Test (push) Has been cancelled
Main / Build Website (push) Has been cancelled
chore: heygermany customer project
2026-07-11 11:03:59 +02:00

56 lines
2.2 KiB
TypeScript

import { defineConfig } from 'vite'
import mdx from '@mdx-js/rollup'
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'
import { getSitemapPages } from './lib/sitemap'
// Plain-object config (not a callback): the fabric deploy injects a CF adapter
// via `mergeConfig(base, thisConfig)`, and vite's mergeConfig cannot merge a
// config in the form of a callback. Paraglide is a hard dependency, so import
// it statically (matches the green germantax/perauset apps).
export default defineConfig({
// Dev-only: forward /api (incl. /api/auth/*) to the local backend. On deploy
// the fabric dispatcher routes /api/* to the API worker, so no app-level proxy
// route is needed (and none must exist — an intercepting route breaks auth).
server: {
proxy: {
'/api': process.env.VITE_API_BASE_URL || 'http://localhost:3000',
},
},
plugins: [
paraglideVitePlugin({
project: './project.inlang',
outdir: './i18n/paraglide',
}),
{ enforce: 'pre', ...mdx() },
tanstackStart({
srcDirectory: 'src',
pages: getSitemapPages(),
sitemap: {
host: process.env.VITE_SITE_URL ?? 'https://hey-germany.com',
},
// Absolute routes/tree paths (matching the green germantax/perauset apps):
// the deploy's route-tree generator reads these literally, so a bare
// 'routes' resolves to apps/website/routes (which doesn't exist) — point at
// the real src/routes so it works in the deploy CI and locally alike.
router: {
routesDirectory: path.resolve(import.meta.dirname, 'src/routes'),
generatedRouteTree: path.resolve(import.meta.dirname, 'src/routeTree.gen.ts'),
},
}),
react({
include: /\.(mdx|js|jsx|ts|tsx)$/,
}),
],
// tsconfig maps `@/*` → `./*` (app root). The build honors it, but vite's dev
// SSR module runner doesn't read tsconfig paths — declare it explicitly so
// `@/...` imports resolve identically in dev and build.
resolve: {
alias: {
'@': path.resolve(import.meta.dirname, '.'),
},
},
})