Skip to content

feat: warn when event listeners are used outside islands in dev mode#344

Open
ElMassimo wants to merge 1 commit into
mainfrom
claude/fix-non-island-listeners-ZYCdq
Open

feat: warn when event listeners are used outside islands in dev mode#344
ElMassimo wants to merge 1 commit into
mainfrom
claude/fix-non-island-listeners-ZYCdq

Conversation

@ElMassimo
Copy link
Copy Markdown
Owner

In production, non-island content is static HTML with no JavaScript, so
event listeners silently fail. In dev mode however, the full Vue app is
hydrated and events work normally — making this bug invisible.

This adds a dev-only Vue compiler directiveTransform that wraps all v-on
handlers with a runtime check. When an event fires on an element that is
NOT inside an (island boundary), the original handler still
executes but a loud console.error and visual overlay warn the developer
that the handler won't work in production.

  • Compiler transform wraps Vue's built-in transformOn to inject the
    wrapper call with source file and line info
  • Runtime wrapper checks DOM ancestry (closest('ile-root')) to detect
    island context
  • Warning overlay renders at the top of the viewport with details
  • Internal iles components (DebugPanel) are excluded from wrapping
  • Only active in development mode; zero impact on production builds

https://claude.ai/code/session_01PYu7eZm5oRpbEazNxR4YMZ

In production, non-island content is static HTML with no JavaScript, so
event listeners silently fail. In dev mode however, the full Vue app is
hydrated and events work normally — making this bug invisible.

This adds a dev-only Vue compiler directiveTransform that wraps all v-on
handlers with a runtime check. When an event fires on an element that is
NOT inside an <ile-root> (island boundary), the original handler still
executes but a loud console.error and visual overlay warn the developer
that the handler won't work in production.

- Compiler transform wraps Vue's built-in transformOn to inject the
  wrapper call with source file and line info
- Runtime wrapper checks DOM ancestry (closest('ile-root')) to detect
  island context
- Warning overlay renders at the top of the viewport with details
- Internal iles components (DebugPanel) are excluded from wrapping
- Only active in development mode; zero impact on production builds

https://claude.ai/code/session_01PYu7eZm5oRpbEazNxR4YMZ
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 6, 2026

View your CI Pipeline Execution ↗ for commit 59f093a

Command Status Duration Result
nx run-many --target=build --all --exclude docs... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-06 23:32:16 UTC

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.

2 participants