fix: use ES module import for Tauri event listeners#407
Open
namastex888 wants to merge 1 commit intowinfunc:mainfrom
Open
fix: use ES module import for Tauri event listeners#407namastex888 wants to merge 1 commit intowinfunc:mainfrom
namastex888 wants to merge 1 commit intowinfunc:mainfrom
Conversation
The event listeners were silently falling back to DOM events instead of Tauri events because require() fails in ES module builds and the environment check was evaluated at module load time. - Use ES module import instead of require() - Check environment at runtime (function) instead of module load (static)
jms830
added a commit
to jms830/opcode
that referenced
this pull request
Dec 8, 2025
- PR winfunc#407: Use ES module import for Tauri event listeners - Fixes event listeners not receiving events in ClaudeCodeSession - Uses runtime check instead of module load time detection - PR winfunc#344: Handle missing ~/.claude directory gracefully - Check if directory exists before canonicalizing - Fall back to original path if canonicalize fails Note: PR winfunc#278 (IME fix) and PR winfunc#373 (installation_type fix) were already implemented
wei201806
added a commit
to wei201806/opcode
that referenced
this pull request
Dec 25, 2025
marlon-costa-dc
pushed a commit
to marlon-costa-dc/opcode
that referenced
this pull request
Jan 25, 2026
Add web-compatible fallback for non-Tauri environments using dynamic listen function that checks environment at runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Tauri event listeners not receiving events in ClaudeCodeSession component.
Problem
The event listeners were silently falling back to DOM events instead of Tauri events because:
require()fails in ES module builds (caught and ignored by try/catch)Solution
import { listen as tauriListen } from "@tauri-apps/api/event"Changes
src/components/ClaudeCodeSession.tsxTesting
using Tauri: truein console