From 59c129398d35ffd27e136031aa6613f684434db0 Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Sun, 14 Jun 2026 01:25:44 -0600 Subject: [PATCH] Improve build speed --- netlify.toml | 2 +- package.json | 2 +- src/routeTree.gen.ts | 10 ++++++++++ vite.config.ts | 5 ++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index 795f0848b..a65be1e3f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,7 +2,7 @@ NODE_OPTIONS = "--max-old-space-size=4096" [build] -command = "vite build && cp src/instrument.server.mjs dist/server" +command = "vite build --logLevel warn && cp src/instrument.server.mjs dist/server" publish = "dist/client" [functions] diff --git a/package.json b/package.json index fe5bebe9c..304ca2b25 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev": "pnpm run with-env vite dev", "with-env": "dotenv -e .env.local", "dev:frontend": "pnpm run with-env vite dev", - "build": "vite build", + "build": "vite build --logLevel warn", "start": "vite start", "start:prod": "pnpm run with-env node scripts/run-built-server.mjs", "content:build": "node scripts/build-content-collections.mjs", diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index 96e20c8b7..c5b106c93 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -3225,3 +3225,13 @@ const rootRouteChildren: RootRouteChildren = { export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() + +import type { getRouter } from './router.tsx' +import type { startInstance } from './start.ts' +declare module '@tanstack/react-start' { + interface Register { + ssr: true + router: Awaited> + config: Awaited> + } +} diff --git a/vite.config.ts b/vite.config.ts index 8adf54a5f..7f61f6068 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -17,6 +17,8 @@ const isDev = process.env.NODE_ENV !== 'production' const shouldUseSentryPlugin = process.env.NODE_ENV === 'production' && Boolean(process.env.SENTRY_AUTH_TOKEN) +const shouldBuildSourcemaps = + shouldUseSentryPlugin || process.env.BUILD_SOURCEMAPS === 'true' const rscSsrExternals = [ // OpenTelemetry uses require-in-the-middle which is CJS-only and breaks @@ -164,7 +166,8 @@ export default defineConfig({ ], }, build: { - sourcemap: process.env.NODE_ENV === 'production', + sourcemap: shouldBuildSourcemaps, + reportCompressedSize: false, rollupOptions: { external: (id) => { // Externalize postgres from client bundle