Skip to content

Commit 6006974

Browse files
aksOpsclaude
andcommitted
fix(ui): adapt to TypeScript 6, Vite 8, @vitejs/plugin-react 6 majors
Three incompatibilities surfaced after the dev-tooling group bump: 1. tsconfig.app.json — TypeScript 6 deprecates `baseUrl`. Since TS 5 `paths` is resolved relative to the tsconfig dir, so drop `baseUrl` entirely and make the `@/*` path explicit (`./src/*`). 2. vite.config.ts — Vite 8 / Rollup 4's `manualChunks` type narrowed to only accept the function form in some overloads. Convert from the `Record<string, string[]>` shape to the function form, matching on `node_modules/<pkg>` paths. 3. Test polyfills — TypeScript 6 / @types/node changes remove the ambient `global` identifier. Switch both jsdom ResizeObserver polyfills to `globalThis`, which is the standard JS spelling. Local verification (Vite 8.0.9 + Vitest 4.1.5 + TypeScript 6.0.3): - npm run typecheck — clean - npm test — 52/52 passing - npm run build — initial chunk 441 KB (budget 580 KB) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ab48899 commit 6006974

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

ui/src/components/layout/__tests__/ThemeToggle.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { ThemeToggle } from "../ThemeToggle";
55
import { useUIStore } from "@/stores/ui";
66

77
// Polyfills for Radix dropdown in jsdom
8-
if (!(global as any).ResizeObserver) {
9-
(global as any).ResizeObserver = class { observe() {} unobserve() {} disconnect() {} };
8+
if (!(globalThis as any).ResizeObserver) {
9+
(globalThis as any).ResizeObserver = class { observe() {} unobserve() {} disconnect() {} };
1010
}
1111
if (!(Element.prototype as any).scrollIntoView) {
1212
(Element.prototype as any).scrollIntoView = () => {};

ui/src/components/notes/__tests__/TreeDrawer.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { server } from "@/test/msw";
77
import { TreeDrawer } from "../TreeDrawer";
88

99
// Polyfills for jsdom that shadcn Sheet (Radix) may need:
10-
if (!(global as any).ResizeObserver) {
11-
(global as any).ResizeObserver = class { observe() {} unobserve() {} disconnect() {} };
10+
if (!(globalThis as any).ResizeObserver) {
11+
(globalThis as any).ResizeObserver = class { observe() {} unobserve() {} disconnect() {} };
1212
}
1313
if (!(Element.prototype as any).scrollIntoView) {
1414
(Element.prototype as any).scrollIntoView = () => {};

ui/tsconfig.app.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
"noUnusedParameters": true,
1818
"noFallthroughCasesInSwitch": true,
1919
"noUncheckedSideEffectImports": true,
20-
"baseUrl": ".",
21-
"paths": { "@/*": ["src/*"] }
20+
"paths": { "@/*": ["./src/*"] }
2221
},
2322
"include": ["src"]
2423
}

ui/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export default defineConfig({
1616
sourcemap: false,
1717
rollupOptions: {
1818
output: {
19-
manualChunks: {
20-
"markdown": ["markdown-it", "shiki"],
21-
"graph": ["d3-force"],
22-
"editor": ["codemirror", "@codemirror/view", "@codemirror/state", "@codemirror/commands", "@codemirror/lang-markdown"],
19+
manualChunks(id) {
20+
if (/node_modules[\\/](markdown-it|shiki)[\\/]/.test(id)) return "markdown";
21+
if (/node_modules[\\/]d3-force[\\/]/.test(id)) return "graph";
22+
if (/node_modules[\\/](codemirror|@codemirror[\\/])/.test(id)) return "editor";
2323
},
2424
},
2525
},

0 commit comments

Comments
 (0)