Skip to content

fix(compiler): prevent syntax error when using exact with all system modifiers - #13325

Open
wdskuki wants to merge 1 commit into
vuejs:mainfrom
wdskuki:fix/exact-modifier-syntax-error
Open

wdskuki wants to merge 1 commit into
vuejs:mainfrom
wdskuki:fix/exact-modifier-syntax-error

Conversation

@wdskuki

@wdskuki wdskuki commented Mar 16, 2026

Copy link
Copy Markdown

Fixes #12319

Problem

When using exact modifier with all system modifiers (ctrl+shift+alt+meta+exact), the compiler generated syntax error code because the filter resulted in an empty array.

Solution

Only add the exact modifier guard when there are remaining modifiers to check.

Changes

  • Modified src/compiler/codegen/events.ts
  • Added test case

Before

if()return null; // SyntaxError

After

Valid code generated

… modifiers

Fixes vuejs#12319

When using .exact modifier with all system modifiers (.ctrl.shift.alt.meta.exact),
the compiler generated syntax error code like 'if()return null;' because the filter
resulted in an empty array.

Changes:
- Only add the exact modifier guard when there are remaining modifiers to check
- This prevents generating empty condition in the if statement

Before:
  if()return null;  // SyntaxError: Unexpected token ')'

After:
  // No empty condition generated, code is valid

Added test case to verify the fix works correctly.
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.

.exact modifier : Failed to generate render function

1 participant