feat: warn when event listeners are used outside islands in dev mode#344
Open
ElMassimo wants to merge 1 commit into
Open
feat: warn when event listeners are used outside islands in dev mode#344ElMassimo wants to merge 1 commit into
ElMassimo wants to merge 1 commit into
Conversation
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
|
View your CI Pipeline Execution ↗ for commit 59f093a
☁️ Nx Cloud last updated this comment at |
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.
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.
wrapper call with source file and line info
island context
https://claude.ai/code/session_01PYu7eZm5oRpbEazNxR4YMZ