Skip to content

fix: replace require() with static ESM import for Tauri events#464

Open
jakeefr wants to merge 1 commit intowinfunc:mainfrom
jakeefr:fix/tauri-esm-import
Open

fix: replace require() with static ESM import for Tauri events#464
jakeefr wants to merge 1 commit intowinfunc:mainfrom
jakeefr:fix/tauri-esm-import

Conversation

@jakeefr
Copy link
Copy Markdown

@jakeefr jakeefr commented Apr 15, 2026

Fixes #462. Replaced require() call with static ESM import so Tauri events correctly reach the frontend in Vite/ESM context. The require() was failing silently, causing all macOS/Linux from-source users to never receive Tauri events.

Also fixed the same pattern in useClaudeMessages.ts for consistency, as noted in the issue.

I maintain PRISM, a post-session diagnostics tool for Claude Code — CLAUDE.md adherence analysis and session health scoring. Fixed this while testing opcode as a frontend for Claude Code sessions.

Vite bundles as ESM where require() is not defined, causing a silent
ReferenceError that falls back to DOM event listeners. The Rust
backend emits events through Tauri's IPC bridge, not the DOM, so
the frontend never receives any events.

Replace the require() + try/catch pattern with a static ESM import
in both ClaudeCodeSession.tsx and useClaudeMessages.ts.

Fixes winfunc#462
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Tauri events never reach frontend — require() fails in ESM/Vite context, falls back to DOM listeners

1 participant