Skip to content

fix(unplugin): keep aliased named imports in definePage extraction - #2832

Merged
posva merged 2 commits into
vuejs:mainfrom
re-thc:vr-fix-4
Oct 9, 2026
Merged

posva merged 2 commits into
vuejs:mainfrom
re-thc:vr-fix-4

Conversation

@re-thc

@re-thc re-thc commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fix definePage extraction, which currently drops aliased named imports that are used inside the definePage({...}) options object.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed handling of aliased named imports during page transformation. Imports referenced through a local alias are now retained with the correct original import name, while unused named imports are removed. This prevents issues when using aliased imports in page definitions and ensures the resulting route metadata is generated correctly.

@netlify

netlify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit b8b183f
🔍 Latest deploy log https://app.netlify.com/projects/vue-router/deploys/6ac8b2e4f222af00089770d3

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: vuejs/router/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c4ee6a9-28f1-4c93-88ad-0da95fc4920c

📥 Commits

Reviewing files that changed from the base of the PR and between 112c064 and b8b183f.


📒 Files selected for processing (1)
  • packages/router/src/unplugin/core/definePage.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

Named-import filtering now checks whether each local binding is used and preserves the original imported name and alias. A test covers a used aliased import.

Changes

Aliased named imports

Layer / File(s) Summary
Filter and test aliased named imports
packages/router/src/unplugin/core/definePage.ts, packages/router/src/unplugin/core/definePage.spec.ts
The filter retains named imports when their local bindings are used and emits the original import name with an alias when needed. A test checks that a used alias remains in the transformed code.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: posva


Merge Risk: ⚪ Minimal · up to b8b18

The change preserves aliased imports used in definePage, and the test covers the expected generated import. No concrete merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main fix: preserving aliased named imports during definePage extraction.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/vue-router@2832
npm i https://pkg.pr.new/vue-router@2832
yarn add https://pkg.pr.new/vue-router@2832.tgz

commit: b8b183f

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.27%. Comparing base (42462bd) to head (b8b183f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2832      +/-   ##
==========================================
+ Coverage   88.26%   88.27%   +0.01%     
==========================================
  Files          78       78              
  Lines        6305     6305              
  Branches     2048     2070      +22     
==========================================
+ Hits         5565     5566       +1     
+ Misses        651      650       -1     
  Partials       89       89              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@posva posva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@posva
posva merged commit 6dec1f4 into vuejs:main Oct 9, 2026
10 checks passed
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