The best way to control Claude Code, Codex and more from any computer or phone
| 1 | // @effect-diagnostics nodeBuiltinImport:off - plain Node script that dev-runner spawns on a cold cache. |
| 2 | /** |
| 3 | * The cache cannot be shared between worktrees: Vite's config hash includes |
| 4 | * the absolute project root, so each worktree must warm its own. |
| 5 | */ |
| 6 | import * as NodePath from "node:path"; |
| 7 | import * as NodeURL from "node:url"; |
| 8 | |
| 9 | import { optimizeDeps, resolveConfig } from "vite"; |
| 10 | |
| 11 | const webRoot = NodePath.dirname(NodePath.dirname(NodeURL.fileURLToPath(import.meta.url))); |
| 12 | |
| 13 | const configStart = performance.now(); |
| 14 | const config = await resolveConfig({ root: webRoot, logLevel: "error" }, "serve"); |
| 15 | if (process.env.T3CODE_STARTUP_PROFILE_DIR) { |
| 16 | performance.measure("web.warmDepCache.resolveConfig", { start: configStart }); |
| 17 | } |
| 18 | const optimizeStart = performance.now(); |
| 19 | await optimizeDeps(config); |
| 20 | if (process.env.T3CODE_STARTUP_PROFILE_DIR) { |
| 21 | performance.measure("web.warmDepCache.optimizeDeps", { start: optimizeStart }); |
| 22 | } |
| 23 | console.log("[warm-dep-cache] web dependency cache is warm"); |