Never miss a release that matters
AI-powered summaries of every GitHub release.
AI Summaries
Changelogs condensed into clear, actionable insights.
Always Free
Track up to 5 packages at no cost, forever.
Weekly Digest
A curated summary of every release, delivered weekly.
TL;DR
Svelte now supports variable declarations directly within your templates, allowing for more concise and readable component logic.
New
- Template Declarations: You can now use
letandconstto declare variables inside Svelte templates. (Declarative programming: defining variables where they’re used)
Fixes Worth Knowing
- Improved parsing and stability of declaration tags, resolving errors related to duplicate definitions, whitespace, and type attributes.
- Fixed issues with asynchronous code, ensuring awaited values are correctly handled in template expressions and effects.
- Resolved several bugs related to event handling and component lifecycle, improving overall reliability.
Before You Upgrade
- Review your usage of asynchronous code and effects to ensure they behave as expected with the improved handling of awaited values.
TL;DR
Svelte now correctly removes event listeners when components are destroyed, preventing potential memory leaks and unexpected behavior.
Fixes Worth Knowing
Resolved an issue where event listeners weren’t always removed when a component unmounted, which could lead to memory leaks or incorrect functionality in dynamic applications.
Before You Upgrade
No specific action is needed; this is a bug fix release.
TL;DR
Svelte 5 introduces significant CSS scoping changes, restricting the use of :not() and :has() selectors to prevent unintended style leakage, and disallows direct state mutation within template logic.
Breaking
- State Mutation in Templates: Directly modifying state variables inside Svelte template expressions is no longer permitted. (Requires updating code to use explicit assignment.)
- CSS Selectors:
:not()and:has()selectors are now scoped, potentially requiring adjustments to complex CSS rules. (May impact component styling.) - Enumerated Types: Stronger type enforcement has been added. (May require code updates to align with stricter types.)
New
- Migration Tasks: New tooling assists with upgrading to Svelte 5, identifying and flagging potentially problematic code patterns. (Helps streamline the upgrade process.)
- Hidden Transitions: Added
until-foundandbeforematchoptions for transitions. (Provides more control over transition behavior.)
Fixes Worth Knowing
- Transitions: Transitions now work correctly within dynamic components.
- Autofocus: Autofocus now applies correctly to static elements.
- Blur Dispatch: Resolved a Chromium-specific issue
TL;DR
Svelte now uses the standard CustomEvent constructor, and developers can optionally expose the Svelte version in the browser (for debugging/reporting).
Breaking
createEventis deprecated; useCustomEventinstead (standard web API for events).
New
- Expose Svelte version in
window(can be disabled). - Smaller bundle sizes for component destructuring.
Fixes Worth Knowing
- Source maps now work correctly with Svelte preprocessors (tools that transform code).
Before You Upgrade
- Update any code using
createEventto use theCustomEventconstructor.