Prebundle @pierre/diffs modules in web Vite config#75
Conversation
- Add `optimizeDeps.include` entries for `@pierre/diffs` packages in web Vite config - Improves dev startup/runtime stability for diff rendering modules
Pre-bundle
|
|
No actionable comments were generated in the recent review. 🎉 WalkthroughAdded Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryAdded
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 2eabd82 |
| import tailwindcss from "@tailwindcss/vite"; | ||
| import react from "@vitejs/plugin-react"; | ||
| import { tanstackRouter } from "@tanstack/router-plugin/vite"; | ||
| import { defineConfig } from "vite"; | ||
| const port = Number(process.env.PORT ?? 5173); | ||
| export default defineConfig({ | ||
| plugins: [ | ||
| tanstackRouter(), | ||
| react({ | ||
| babel: { | ||
| plugins: [["babel-plugin-react-compiler", { target: "19" }]], | ||
| }, | ||
| }), | ||
| tailwindcss(), | ||
| ], | ||
| optimizeDeps: { | ||
| include: ["@pierre/diffs", "@pierre/diffs/react", "@pierre/diffs/worker/worker.js"], | ||
| }, | ||
| define: { | ||
| // In dev mode, tell the web app where the WebSocket server lives | ||
| "import.meta.env.VITE_WS_URL": JSON.stringify(process.env.VITE_WS_URL ?? ""), | ||
| }, | ||
| experimental: { | ||
| enableNativePlugin: true, | ||
| }, | ||
| resolve: { | ||
| tsconfigPaths: true, | ||
| }, | ||
| server: { | ||
| port, | ||
| strictPort: true, | ||
| hmr: { | ||
| // Explicit config so Vite's HMR WebSocket connects reliably | ||
| // inside Electron's BrowserWindow. Vite 8 uses console.debug for | ||
| // connection logs — enable "Verbose" in DevTools to see them. | ||
| protocol: "ws", | ||
| host: "localhost", | ||
| }, | ||
| }, | ||
| build: { | ||
| outDir: "dist", | ||
| emptyOutDir: true, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Both vite.config.js and vite.config.ts exist. Vite prefers .ts, making this file potentially unused. Consider removing to avoid confusion.
Summary
optimizeDeps.includetoapps/web/vite.config.tsfor@pierre/diffs,@pierre/diffs/react, and@pierre/diffs/worker/worker.js.optimizeDeps.includechange inapps/web/vite.config.js.Testing
Note
Low Risk
Vite dev-tooling configuration only; no runtime business logic changes, but incorrect prebundling could cause local dev/startup issues.
Overview
Configures the web app’s Vite dev server to prebundle
@pierre/diffs(including@pierre/diffs/reactand the worker entry@pierre/diffs/worker/worker.js) viaoptimizeDeps.include.This change is mirrored in both
apps/web/vite.config.tsandapps/web/vite.config.jsto reduce dev-time dependency resolution issues when using the diffs components/worker.Written by Cursor Bugbot for commit 2eabd82. This will update automatically on new commits. Configure here.
Summary by CodeRabbit