Skip to content

Conversation

@ocavue
Copy link
Contributor

@ocavue ocavue commented Nov 20, 2025

Changes

Updates @sveltejs/vite-plugin-svelte in package.json from v5 to v6

@sveltejs/[email protected] drops support for Node v18 and requires Node v20.19+. This is the same requirement as the upcoming astro v6.

Check this link for the full changelog of @sveltejs/[email protected]:

Ignores modules IDs with \0

vite-plugin-svelte v5 used to use createFilter from rollup to match Svelte files. createFilter includes all IDs with \0 at createFilter.ts#L51. This ensures that all virtual modules with an ID starting with \0astro-entry: won't be matched.

vite-plugin-svelte v6 uses Vite's new object hook syntax for matching and simply matches all IDs ending with .svelte.

NOTE

The include logic has changed to files matching svelteConfig.include OR svelteConfig.extensions. Previously, only files matching both were loaded and transformed.

This change causes the following errors:

test at test/async-rendering.test.js:15:2
✖ build (1495.049839ms)
  [[vite-plugin-svelte:compile] [plugin vite-plugin-svelte:compile] astro-entry:/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte (1:9): astro-entry:/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte:1:9 Unexpected token
  https://svelte.dev/e/js_parse_error
  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"
                 ^
  
  ] {
    name: 'RollupError',
    id: '\x00astro-entry:/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte',
    frame: ' 1 |  export { default } from "/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte"\n               ^',
    code: 'PLUGIN_ERROR',
    loc: { line: 1, column: 9, file: '\x00astro-entry:/home/runner/work/astro/astro/packages/integrations/svelte/test/fixtures/async-rendering/src/components/Counter.svelte' },
    pluginCode: 'js_parse_error',
    plugin: 'vite-plugin-svelte:compile',
    hook: 'transform',
    watchFiles: [ '/home/runner/work/astro/astro/packages/integrations/svelte/package.json' ]
  }

I fixed this issue by excluding all modules with \0.

Testing

Update some package.json files of the integration tests so that they will use the local build of @astrojs/svelte.

- "@astrojs/svelte": "^7.1.1",
+ "@astrojs/svelte": "workspace:*",

Docs

See changeset.

@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

🦋 Changeset detected

Latest commit: 809e318

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 pkg: svelte Related to Svelte (scope) pkg: integration Related to any renderer integration (scope) labels Nov 20, 2025
@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Nov 20, 2025
@github-actions github-actions bot removed the pkg: astro Related to the core `astro` package (scope) label Nov 20, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

📝 Changeset Validation Results

Changeset validation failed

Issues Found:

.changeset/soft-rings-attend.md

Issue with: 'Updates @sveltejs/vite-plugin-svelte to v6.'

❌ The description does not include sufficient migration guidance or breaking change details for a major update.

💡 Suggestions:
• Provide explicit migration steps or user actions required due to the update:
• ```markdown
Removes the deprecated @sveltejs/vite-plugin-svelte API version v5. Update to v6 and follow the migration instructions detailed here: [Link].


**General Errors:**
- The changeset header lacks clarification on the update impact or provides migration guidance.

**General Suggestions:**
- Consider elaborating the description to specify the impacts of the update.

---
*📖 See [Astro's changeset guide](https://contribute.docs.astro.build/docs-for-code-changes/changesets/) for details.*

@ocavue ocavue marked this pull request as ready for review November 20, 2025 07:08
@ocavue ocavue marked this pull request as draft November 20, 2025 07:38
@ocavue
Copy link
Contributor Author

ocavue commented Nov 20, 2025

The HMR testing is failing. It seems that vite-plugin-svelte requires Vite's environment API (see hot-update.js#L48 and hot-update.js#L102) for HMR.

It might be best for this PR to wait until #14306 is merged into next.

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) pkg: svelte Related to Svelte (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant