[Bug]: astro-frontmatter-scan esbuild plugin missing namespace filter causes "No matching export" errors during dep scan
Astro v6.1.3
Vite v7.3.1
Node v25.8.2
System macOS (x64)
Package Manager npm
Output server
Adapter @astrojs/cloudflare (v13.1.7)
Integrations none
N/A (build-time error)
When a .ts file default-imports .astro components (the same pattern used by @storyblok/astro's virtual:import-storyblok-components), astro build logs errors like:
[ERROR] No matching export in "html:/path/to/Component.astro" for import "default"
The astro-frontmatter-scan esbuild plugin (in @astrojs/cloudflare) registers its onLoad handler without a namespace filter:
// esbuild-plugin-astro-frontmatter.js
build.onLoad({ filter: /\.astro$/ }, async (args) => { ... });This intercepts .astro files in both the file and html esbuild namespaces. When a .ts file imports a .astro file, esbuild resolves that .astro import in the html namespace. The plugin extracts only the frontmatter (which has no export default), so the default import fails.
The build ultimately succeeds because Vite falls back when dep scanning fails ("Skipping dependency pre-bundling"), but the errors are noisy and dep pre-bundling is skipped entirely, which may hurt performance.
No errors during dependency scanning. The astro-frontmatter-scan plugin should scope its onLoad to the file namespace, and provide a separate handler for the html namespace that appends export default {} — matching what Vite's own html-type loader would have done.
Add a namespace filter to the existing handler and add a second handler for the html namespace:
// Scope to "file" namespace (original behavior):
build.onLoad({ filter: /\.astro$/, namespace: "file" }, async (args) => ({
contents: extractFrontmatter(args.path),
loader: "ts",
}));
// "html" namespace: append a default export so default imports resolve:
build.onLoad({ filter: /\.astro$/, namespace: "html" }, async (args) => ({
contents: extractFrontmatter(args.path) + "\nexport default {};",
loader: "ts",
}));https://github.com/adamchal/cloudflare-frontmatter-scan
- I am willing to submit a pull request for this issue.