TanStackT
TanStack4w ago
12 replies
skinny-azure

Slow initial load when deployed to Vercel

It seems like my TanStack Start app loads very slowly initially when it's deployed to Vercel. You can see it here: https://preachx.ai

My config feels very vanilla:
export default defineConfig({
  plugins: [
    tailwindcss(),
    // Enables Vite to resolve imports using path aliases.
    tsconfigPaths(),
    tanstackStart({
      router: {
        // Specifies the directory TanStack Router uses for your routes.
        routesDirectory: 'app', // Defaults to "routes", relative to srcDirectory
      },
      srcDirectory: 'src', // This is the default
    }),
    // Generates locally-trusted SSL certificates for HTTPS in development
    // Required for cross-site cookies (sameSite: 'none', secure: true) to work
    ...(process.env.NODE_ENV === 'development' ? [mkcert()] : [nitro()]),
    viteReact({
      babel: {
        plugins: ['babel-plugin-react-compiler'],
      },
    }),
  ],
  server: {
    port: 3001,
  },
  ssr: {
    // Bundle these packages during SSR so Vite can handle CSS imports
    noExternal: ['@platejs/math', 'katex'],
  },
})
image.png
PreachX
The elders who direct the affairs of the org well are worthy of double honor, especially those whose work is preaching and teaching. 1 Timothy 5:17
PreachX
Was this page helpful?