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

vite.config.ts

33 lines1.2 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'
6import { durableDeliveryWebSocketPlugin } from './src/lib/durable-delivery-ws-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 resolve: { tsconfigPaths: true },
20 plugins: [
21 durableDeliveryWebSocketPlugin(),
22 nitroV2Plugin({
23 externals: {
24 external: ['@elevenlabs/elevenlabs-js'],
25 },
26 }),
27 tailwindcss(),
28 tanstackStart(),
29 viteReact(),
30 ],
31})
32​
33export default config