Skip to content

fix(cloudflare): add namespace filter to astro-frontmatter-scan esbuild plugin#16272

Open
barry3406 wants to merge 2 commits intowithastro:mainfrom
barry3406:fix/esbuild-frontmatter-namespace-filter
Open

fix(cloudflare): add namespace filter to astro-frontmatter-scan esbuild plugin#16272
barry3406 wants to merge 2 commits intowithastro:mainfrom
barry3406:fix/esbuild-frontmatter-namespace-filter

Conversation

@barry3406
Copy link
Copy Markdown
Contributor

Fixes #16203

Problem

The astro-frontmatter-scan esbuild plugin registers its onLoad handler without a namespace filter. In esbuild, an unfiltered onLoad matches all namespaces, including html. When a .ts file default-imports an .astro component, Vite's dep scanner resolves the .astro file into the html namespace. The plugin intercepts it and returns only the extracted frontmatter — which has no export default — causing:

[ERROR] No matching export in "html:/path/to/Component.astro" for import "default"

Fix

Add namespace: 'file' to the onLoad call so the plugin only handles .astro files resolved from the filesystem. Files in the html namespace now fall through to Vite's built-in htmlTypeOnLoadCallback, which already appends export default {} for non-.vue files.

Test plan

  • Verified against the reproduction repo from the issue: error no longer occurs
  • file namespace behavior is unchanged — same handler, same logic, only the namespace scope is narrowed

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

⚠️ No Changeset found

Latest commit: 2c368c9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: astro-frontmatter-scan esbuild plugin missing namespace filter causes "No matching export" errors during dep scan

1 participant