Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Svelte 5 #117

Open
boylett opened this issue Aug 20, 2024 · 10 comments · May be fixed by #146
Open

Svelte 5 #117

boylett opened this issue Aug 20, 2024 · 10 comments · May be fixed by #146
Labels
enhancement New feature or request

Comments

@boylett
Copy link

boylett commented Aug 20, 2024

Are there plans for Svelte 5 support? :)

@BearToCode
Copy link
Owner

Hi! I've not tried Svelte 5 yet. I think it was supposed to be backward compatible(?)

@tvanriper
Copy link

Yes and no. They do have some breaking changes that they can't get around, although I haven't seen those impact this library (yet). They also need library authors to create a separate branch for Svelte 5 changes, particularly since eventually the changes will become breaking.

It'll be advantageous to move to Svelte 5 as it addresses some shortcomings for the environment, although some people find it controversial, I suppose ("Oh no! It's become ReactJS!").

Currently, I am trying to use this library with Svelte 5, and while it works, I'm constantly having to apply --force or --legacy-peer-deps to work with my project.

FWIW, this site might clarify some things, now that Svelte 5 has reached release candidate phases.

@BearToCode BearToCode added the enhancement New feature or request label Oct 9, 2024
@BearToCode
Copy link
Owner

I checked out the resources you provided and then added svelte ^5.0.0 to the package.json of almost all packages. Only the component plugin requires some changes and a new version would need to be published.

Feel free to answer here or open new issues for anything going wrong in the new Svelte version!

@mithi
Copy link

mithi commented Oct 26, 2024

@BearToCode hi! Long time no see 🤗
Svelte 5 is officially alive! 🥳 https://svelte.dev/blog/svelte-5-is-alive

@katriellucas
Copy link

katriellucas commented Nov 3, 2024

I also want to add that by using the new CLI command sv migrate, upgrading to Svelte 5 might be painless. The migration guide gives you an overview of the changes.

@DJMogens
Copy link

Any updates on this?

@BearToCode
Copy link
Owner

Any updates on this?

Carta should work fine with Svelte 5. I tried using that in a project of mine and everything seemed ok. Did you experience any issue?

@DJMogens
Copy link

DJMogens commented Feb 17, 2025

I had a problem with the components plugin, as it instanciates the components in a legacy matter, treating it as a class.

I have to set a compatibility flag to the compiler for it to work.

https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes

@DJMogens
Copy link

DJMogens commented Feb 17, 2025

Just tried to run the migration script, and most packages are pretty much unaffected:

Here is a screenshot of the files modified by running it in each of the packages (excluding the package.json modifications)
Image

It migrates things like:

Image

Image

@BearToCode
Copy link
Owner

BearToCode commented Feb 18, 2025

You're right, the component plugin still doesn't work in Svelte 5. A quick fix could be made to make it work, but it's probably better to upgrade the whole project at the same time. I saw that @mtsgrd also opened a PR to upgrade (#146 ). I'll look into it as soon as I can, but it will probably take some time. Meanwhile, you said that you can temporarily work with it using a compiler flag, right?

Aside from the changes generated, the following will also have to be updated:

https://github.com/BearToCode/carta/blob/4637d26fcddc1b673a66092e904ddf99d840d4c0/packages/plugin-component/src/lib/svelte.ts#L131C1-L134C6

to something like:

mount(component.component, {
	target: wrapper,
	props
});

But I haven't tried it yet.

@BearToCode BearToCode linked a pull request Feb 19, 2025 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants