Skip to content

Fix file import using alias matching directory name - #15179

Merged
matthewp merged 1 commit into
nextfrom
hd/fix-import-alias-matching-directory
Jan 12, 2026
Merged

matthewp merged 1 commit into
nextfrom
hd/fix-import-alias-matching-directory

Conversation

@HiDeoo

@HiDeoo HiDeoo commented Jan 12, 2026

Copy link
Copy Markdown
Member

Changes

Initially reported on Discord, this PR fixes an issue when importing using an import alias a file with a name matching a directory name.

  • Repro
  • The custom resolver used in the vite plugin to alias paths now checks if a match is a file instead of only relying on fs.existsSync(), which returns true for both files and directories.

Testing

  • Added a new src/pages.ts file in the existing alias-tsconfig fixture, matching the name of the src/pages/ directory, and imported it using an alias.
    • The associated test fails before the fix.
    • The test succeeds after the fix.

Docs

This is a bug fix; no doc updates are needed.

@changeset-bot

changeset-bot Bot commented Jan 12, 2026

Copy link
Copy Markdown

πŸ¦‹ Changeset detected

Latest commit: d14130e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label Jan 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Package Trust Level Decreased

Caution

Decreased trust levels may indicate a higher risk of supply chain attacks. Please review these changes carefully.

πŸ“¦ Package πŸ”’ Before πŸ”“ After
@cloudflare/kv-asset-handler trusted-with-provenance none
@cloudflare/unenv-preset trusted-with-provenance none
workerd trusted-with-provenance none
undici provenance none
miniflare trusted-with-provenance none
youch provenance none
@cloudflare/workerd-darwin-64 trusted-with-provenance none
@cloudflare/workerd-darwin-arm64 trusted-with-provenance none
@cloudflare/workerd-linux-64 trusted-with-provenance none
@cloudflare/workerd-linux-arm64 trusted-with-provenance none
@cloudflare/workerd-windows-64 trusted-with-provenance none
wrangler trusted-with-provenance none

@HiDeoo
HiDeoo marked this pull request as ready for review January 12, 2026 16:29
@matthewp
matthewp merged commit 8c8aee6 into next Jan 12, 2026
22 checks passed
@matthewp
matthewp deleted the hd/fix-import-alias-matching-directory branch January 12, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants