Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

vite.config.ts

34 lines1.1 KB

1import { defineConfig } from 'vite'
2import { tanstackStart } from '@tanstack/react-start/plugin/vite'
3import viteReact from '@vitejs/plugin-react'
4import viteTsConfigPaths from 'vite-tsconfig-paths'
5import tailwindcss from '@tailwindcss/vite'
6import { nitroV2Plugin } from '@tanstack/nitro-v2-vite-plugin'
7​
8const config = defineConfig({
9 // Server-side only fix. @elevenlabs/elevenlabs-js ships a top-level
10 // `function getHeader(…)` that collides with h3's auto-imported
11 // `getHeader` when vite inlines it into the SSR bundle. The SDK is
12 // only imported by server routes (api.tts*.ts, api.transcription*.ts),
13 // so tree-shaking already keeps it out of the client bundle — this
14 // option only affects the SSR build, where we want the SDK resolved at
15 // runtime via require() instead of inlined into the rollup chunk.
16 ssr: {
17 external: ['@elevenlabs/elevenlabs-js'],
18 },
19 plugins: [
20 nitroV2Plugin({
21 externals: {
22 external: ['@elevenlabs/elevenlabs-js'],
23 },
24 }),
25 viteTsConfigPaths({
26 projects: ['./tsconfig.json'],
27 }),
28 tailwindcss(),
29 tanstackStart(),
30 viteReact(),
31 ],
32})
33​
34export default config