Files
bot-hub/vite.config.ts
zeekayandHanzo Dev f12e81b1da fix(vite): drop the dead Convex wiring that stops the config loading
vite.config.ts resolved Convex at MODULE LOAD time:

    const convexEntry = require.resolve('convex')
    const convexAuthReactPath = require.resolve('@convex-dev/auth/react')

Convex is not here. Not in package.json, not in any packages/* workspace,
zero matches in bun.lock, and zero source files import it. So require.resolve
throws before defineConfig is ever called, and vite reports only

    failed to load config from /app/vite.config.ts
    error during build:
    undefined

— which names neither the package nor the line, and looks like a broken
toolchain rather than a missing dependency.

Removed the resolution block, the convex/@convex-dev aliases, the
optimizeDeps includes, and the dedupe entries, plus the node:module and
node:path imports that existed only to serve them. resolve.dedupe keeps
react/react-dom, which is the part that was doing real work.

The alternative — adding convex back — would install a dependency nothing
imports to satisfy aliases nothing uses.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 13:14:39 -07:00

61 lines
1.5 KiB
TypeScript

import tailwindcss from '@tailwindcss/vite'
import { devtools } from '@tanstack/devtools-vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import { nitro } from 'nitro/vite'
import { defineConfig } from 'vite'
import viteTsConfigPaths from 'vite-tsconfig-paths'
function handleRollupWarning(
warning: { code?: string; message: string; id?: string },
warn: (warning: { code?: string; message: string; id?: string }) => void,
) {
if (
warning.code === 'MODULE_LEVEL_DIRECTIVE' &&
warning.id?.includes('node_modules') &&
/use client/i.test(warning.message)
) {
return
}
if (
warning.code === 'UNUSED_EXTERNAL_IMPORT' &&
/@tanstack\/start-|@tanstack\/router-core\/ssr\/(client|server)/.test(warning.message)
) {
return
}
if (warning.code === 'EMPTY_BUNDLE' || /Generated an empty chunk/i.test(warning.message)) {
return
}
warn(warning)
}
const config = defineConfig({
resolve: {
dedupe: ['react', 'react-dom'],
},
plugins: [
devtools(),
nitro({
serverDir: 'server',
rollupConfig: {
onwarn: handleRollupWarning,
},
}),
// this is the plugin that enables path aliases
viteTsConfigPaths({
projects: ['./tsconfig.json'],
}),
tailwindcss(),
tanstackStart(),
viteReact(),
],
build: {
chunkSizeWarningLimit: 900,
rollupOptions: {
onwarn: handleRollupWarning,
},
},
})
export default config