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

vite.config.ts

31 lines1.1 KB

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