Compatibility for libraries publishing compiled components #14573
Replies: 4 comments 4 replies
-
I don't think you can decompile an old Svelte component, unless you try to do it by hand (and you'd have to know a lot about Svelte's old internals). Since the structure of compiled Svelte components changed dramatically in v5, it'd be very difficult if not impossible to make an old compiled conponent work in Svelte 5. |
Beta Was this translation helpful? Give feedback.
-
I think you've misunderstood what I'm asking. |
Beta Was this translation helpful? Give feedback.
-
none, you are responsible for ensuring precompiled component output is paired with the exact compiler/runtime version. Even patch releases of svelte can make incompatible changes to the output, it is expected that all .svelte code is compiled by the same version and paired with a runtime for that version (taken care of by sveltekit and if you import source .svelte files from libraries as packaged with svelte-package.) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. Is this likely to change at any point? |
Beta Was this translation helpful? Give feedback.
-
I am looking to get a bit more information about compatibility guarantees when publishing a library of svelte components.
This isn't really stated anywhere in the svelte docs, but sveltekit has this https://svelte.dev/docs/kit/packaging, and there are a few related issues from way back in the svelte 1 days along similar lines. It appears the current recommendation is that libraries publish svelte components as svelte source code (preprocessed, but still
.svelte
source code).We have quite a large library (currently internal usage only, but a library none the less) of svelte components. We were publishing it as svelte source initially, but:
So because of this we changed to publish the built versions of the components instead, which simplified and sped things up significantly (except for the issue with trying to generate
.d.ts
files, but we'll ignore that here!).Since then, our library and all derived apps have been pinned to svelte 3.55.1 to avoid compatibility issues. Now that svelte5 is here we would like to upgrade everything.
However, we really need to know what is the svelte team's policy regarding compatibility for compiled svelte components?
I fully expect that jumping major version is not supported, which is fair enough. However, with svelte 5 still under such rapid development, it seems very likely that we'll want to do fairly regular minor upgrades. Can we rely on these being forwards or backwards compatible so that we can upgrade our library or apps independently?
If we have to do these in a specific order so that the lib always has to be upgraded first or vice-versa that's fine, I just really want to avoid having to keep upgrading everything at exactly the same time.
Beta Was this translation helpful? Give feedback.
All reactions