Skip to content

support Svelte 5#87

Closed
JReinhold wants to merge 1 commit into
sveltejs:masterfrom
JReinhold:support-svelte-5
Closed

support Svelte 5#87
JReinhold wants to merge 1 commit into
sveltejs:masterfrom
JReinhold:support-svelte-5

Conversation

@JReinhold
Copy link
Copy Markdown

@JReinhold JReinhold commented Dec 1, 2023

Expand the peer dependency range for Svelte to include Svelte 5 prereleases.

SvelteKit uses svelte-hmr under the hood, but given that svelte-hmr doesn't allow Svelte 5, strict package managers will consider a SvelteKit + Svelte 5 project invalid even if SvelteKit supports it in the dependency range.

Here's what yarn explain peer-requirements has to say on the matter:

We have a problem with svelte, which is provided with version 5.0.0-next.17.
It is needed by the following direct dependencies of workspaces in your project:

  ✓ @storybook/sveltekit@portal:/Users/jeppe/dev/work/storybook/storybook/code/frameworks/sveltekit::locator=svelte-kit-prerelease-ts%40workspace%3A. [f85c6] (via ^4.0.0 || ^5.0.0-next.16)

However, those packages themselves have more dependencies listing svelte as peer dependency:

  ✓ @sveltejs/vite-plugin-svelte-inspector@npm:2.0.0 [c7b72] (via ^4.0.0 || ^5.0.0-next.0)
  ✘ svelte-hmr@npm:0.15.3 [c7b72] (via ^3.19.0 || ^4.0.0)
  ✓ @sveltejs/vite-plugin-svelte@npm:3.0.1 [cedf8] (via ^4.0.0 || ^5.0.0-next.0)
  ✓ svelte-preprocess@npm:5.1.1 [cedf8] (via ^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0)
  ✓ @storybook/svelte-vite@portal:/Users/jeppe/dev/work/storybook/storybook/code/frameworks/svelte-vite::locator=svelte-kit-prerelease-ts%40workspace%3A. [f0054] (via ^4.0.0 || ^5.0.0-next.16)

Put together, the final range we computed is ^4.0.0 || ^4.0.0

This is currently blocking Storybook from testing against Svelte 5 in our ecosystem CI

@benmccann
Copy link
Copy Markdown
Member

I asked the other maintainers about this. svelte-hmr doesn't work for 5. The hmr api is going to be added directly into svelte compiler in dev mode at some point. Given that this library will never support Svelte 5, I'm not sure this is the correct fix.

@dominikg
Copy link
Copy Markdown
Contributor

dominikg commented Dec 2, 2023

In general svelte5 support in vite-plugin-svelte (and sveltekit) is marked as experimental, svelte-5 is still in alpha so expect breaking changes from time to time.
Due to the experimental nature there are a few things that are not perfect rn and peer dependency ranges is one of them.

pnpm allows you to silence peer dependency warnings by name, maybe yarn has a similar feature? Otherwise i'd recommend to disable strict peer checks for the svelte5 test altogether.

It's very likely that there is going to be a new major release for vite-plugin-svelte to add proper support for svelte5 that no longer depends on svelte-hmr.

@JReinhold
Copy link
Copy Markdown
Author

That's fair, thanks for the feedback!

We actually explicitly tell Yarn to error on incompatible peer dependencies in our CI. This does cause problems sometimes with upstreams like this, but it also often catches problems caused by our internal packages.

Either way this is something to solve on our side, I'll figure out a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants