Skip to content

fix(astro): add .js suffix to component entry modules - #14964

Closed
ocavue wants to merge 2 commits into
withastro:nextfrom
ocavue-forks:ocavue/fix-entry-prefix2
Closed

ocavue wants to merge 2 commits into
withastro:nextfrom
ocavue-forks:ocavue/fix-entry-prefix2

Conversation

@ocavue

@ocavue ocavue commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Changes

When updating @sveltejs/vite-plugin-svelte from v5 to v6, the build fails with a parsing error:

[vite-plugin-svelte:compile] Unexpected token
file: astro-entry:/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte:1:9
  
   1 |  export { default } from "/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte"
                 ^

Root cause: pluginComponentEntry creates virtual modules like \0astro-entry:.../Component.svelte containing re-export statements.

In @sveltejs/vite-plugin-svelte v6, these modules are incorrectly treated as Svelte components due to the .svelte extension, causing parse errors.

In @sveltejs/vite-plugin-svelte v5, these modules are ignored because the module id contains \0 and get filtered out at createFilter.ts#L51.

See also: changelog for @sveltejs/vite-plugin-svelte v6.0.0

Solution: Add a .js suffix to virtual entry modules for non-JS files (like .svelte, .vue, etc.) to ensure that SFC plugins won't mistakenly process them as components.

This fix is applicable to all UI frameworks with custom file extensions, including Vue, Svelte, Marko, Riot, Ripple, and any other SFC framework that may arise in the future.

Testing

All existing tests pass.

Docs

No docs/changeset added because there are no changes to the public API. The pluginComponentEntry is just an implementation detail.

(I can add a changeset if the Astro team thinks it's necessary.)

@changeset-bot

changeset-bot Bot commented Dec 5, 2025 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 985e764

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: astro Related to the core `astro` package (scope) label Dec 5, 2025
@ocavue
ocavue marked this pull request as ready for review December 5, 2025 01:02
@github-actions

github-actions Bot commented Jan 7, 2026

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/unenv-preset trusted-with-provenance none
workerd trusted-with-provenance none
ts-api-utils 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

@ocavue

ocavue commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

see #14821

@ocavue ocavue closed this Jan 7, 2026
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.

1 participant