Files
openchamber/packages/vscode/vite.config.ts
T
Bohdan Triapitsyn 1231fd773e feat: improve VS Code dev flow and stabilize sidebar/chat behavior (#754)
* fix: improve session sidebar tooltip and truncation behavior

- Keep new-draft tooltip anchored to its trigger button
- Fix minimal-mode worktree/group header text truncation
- Tune minimal-mode right padding to reduce early label clipping

* fix: render reasoning through markdown pipeline

- Use Streamdown rendering for reasoning in live chat mode
- Remove italic styling from reasoning text
- Render expanded reasoning content with MarkdownRenderer

* chore: remove legacy electron dependencies

- Removed unused Electron packages from root and UI manifests
- Deleted obsolete Electron context menu type declaration
- Regenerated lockfile after dependency cleanup

* fix: handle non-repository folders in git status API

- Prevent 500 errors when status is requested outside a valid Git repo
- Improve repository detection using `git rev-parse --git-dir`
- Reduce noisy server logs for expected non-repo status checks

* fix unloaded session chat layout flicker

* fix: reduce noisy TTS status polling

Cache and dedupe TTS status requests, and only check provider availability when the related voice features are enabled so disabled voice setups stay quiet.

* perf: throttle background PR git status refreshes

* fix: improve VS Code Explorer file drop mentions in chat

- Add Explorer context action to insert selected files as @mentions.
- Handle Explorer drag-and-drop to prefill @file mentions instead of attachments.
- Prevent duplicate plain-path text when dropping multiple files.

* fix: deduplicate recent sessions in VS Code sidebar

- Hide sessions from main list when already shown in recent
- Apply dedup only in VS Code runtime
- Keep session search behavior unchanged

* feat: add true HMR dev flow for VS Code extension

- Load VS Code webview from Vite dev server with React refresh preamble
- Add `vscode:dev` runner that starts watchers and opens Extension Development Host
- Update VS Code dev docs and scripts to use the new HMR startup flow

* feat: polish VS Code session sidebar and attachment UX

- Add resizable sessions sidebar in VS Code layout
- Tighten session list spacing and hover behavior in VS Code
- Remove bulk file/image attach success toasts while keeping error toasts
2026-03-23 23:51:55 +02:00

66 lines
1.8 KiB
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig(({ mode }) => ({
root: path.resolve(__dirname, 'webview'),
base: './', // Use relative paths for VS Code webview
plugins: [
react({
babel: {
plugins: ['babel-plugin-react-compiler'],
},
}),
],
resolve: {
alias: [
{ find: '@opencode-ai/sdk/v2', replacement: path.resolve(__dirname, '../../node_modules/@opencode-ai/sdk/dist/v2/client.js') },
{ find: '@openchamber/ui', replacement: path.resolve(__dirname, '../ui/src') },
{ find: '@vscode', replacement: path.resolve(__dirname, './webview') },
{ find: '@', replacement: path.resolve(__dirname, '../ui/src') },
],
},
worker: {
format: 'es',
},
define: {
'process.env.NODE_ENV': JSON.stringify(mode === 'production' ? 'production' : 'development'),
'global': 'globalThis',
'__OPENCHAMBER_WEBVIEW_BUILD_TIME__': JSON.stringify(new Date().toISOString()),
},
envPrefix: ['VITE_'],
server: {
host: 'localhost',
port: 5173,
strictPort: true,
cors: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
hmr: {
host: 'localhost',
protocol: 'ws',
port: 5173,
},
},
optimizeDeps: {
include: ['@opencode-ai/sdk/v2'],
},
build: {
outDir: path.resolve(__dirname, 'dist/webview'),
emptyOutDir: true,
rollupOptions: {
input: path.resolve(__dirname, 'webview/index.html'),
external: ['node:child_process', 'node:fs', 'node:path', 'node:url'],
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name].[ext]',
},
},
},
}));