← 输入框|github.com|刷新
Skip to content

fix(vite): recognize aliased default exports in link checks - #11567

Merged
NathanWalker merged 2 commits into
NativeScript:mainfrom
aleclarson:fix/vite-default-export-link-check
Oct 22, 2026
Merged

NathanWalker merged 2 commits into
NativeScript:mainfrom
aleclarson:fix/vite-default-export-link-check

Conversation

@aleclarson

Copy link
Copy Markdown
Contributor

PR Checklist

  • The PR title follows the commit guidelines.
  • There is an issue for this bug.
  • CLA status verified.
  • All existing tests pass locally (five baseline failures described below).
  • Tests for the changes are included.

What is the current behavior?

The native dev module server rejects valid defaults such as export { named as default }, while comments and strings containing export default can bypass validation.

What is the new behavior?

Use the existing Babel parser to inspect export declarations and specifiers, including aliases, quoted names, and namespace re-exports. Missing runtime defaults remain rejected; CommonJS handling is preserved. Adds 18 route-handler regression tests, including revalidation when a target gains or loses its default.

Validation: eight new tests fail before the fix; all 18 pass afterward. npx nx run vite:build passes. The full vite:test run passes 1,912 tests and fails five typescript-optional.spec.ts cases with The "paths[1]" argument must be of type string. Received undefined; the same five fail with unchanged upstream production source in this worktree. No device startup or HMR verification.

Fixes #11566.

@nx-cloud

nx-cloud Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7c875e8

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 31s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-22 23:36:02 UTC

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11567
npm i https://pkg.pr.new/@nativescript/vite@11567
npm i https://pkg.pr.new/@nativescript/webpack@11567

commit: 7c875e8

@aleclarson

Copy link
Copy Markdown
Contributor Author

A possible follow-up is to use es-module-lexer for this check. We only need exported names, so lexing could reduce CPU time and allocations compared with constructing a full Babel AST for each checked target module. That benefit is unmeasured so far; Babel would still be needed elsewhere in this pipeline.

This PR reuses the existing Babel dependency to keep the correctness fix focused. Before switching, we should benchmark representative transformed modules, run the regression cases against the chosen lexer version (including aliases, quoted names, namespace re-exports, and type-only exports), and account for its initialization requirements. If target parsing is a meaningful dev-server cost, the lexer could be a useful optimization.

@NathanWalker
NathanWalker merged commit 26db23c into NativeScript:main Oct 22, 2026
7 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.

@nativescript/vite: link check rejects valid aliased default exports

2 participants