carta
carta copied to clipboard
Svelte 5
Are there plans for Svelte 5 support? :)
Hi! I've not tried Svelte 5 yet. I think it was supposed to be backward compatible(?)
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.
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!
@BearToCode hi! Long time no see 🤗 Svelte 5 is officially alive! 🥳 https://svelte.dev/blog/svelte-5-is-alive
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.
Any updates on this?
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?
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
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)
It migrates things like:
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.