Packages

svelte

5.58.0 · 18 Nov 2026MIT10.4M / weekRepositoryHomepagenpmAtom feed

Your version

4.0.0

major22 Jun 2023Where it was published

4.2.20 is the newest release of 4.x.

In short

21 breaking10 new14 fixed1 internal

  • Breaking

    Minimum supported Node version is now Node 16

  • Breaking

    Minimum supported webpack version is now webpack 5

  • Breaking

    Bundlers must specify the browser condition when building a frontend bundle for the browser

  • Breaking

    Minimum supported vite-plugin-svelte version is now 2.4.1. SvelteKit users can upgrade to 1.20.0 or newer to ensure a compatible version

  • Breaking

    Minimum supported rollup-plugin-svelte version is now 7.1.5

  • Breaking

    Minimum supported svelte-loader is now 3.1.8

  • Breaking

    Minimum supported TypeScript version is now TypeScript 5 (it will likely work with lower versions, but we make no guarantees about that)

  • Breaking

    Remove svelte/register hook, CJS runtime version and CJS compiler output

Security

7 advisories affect 4.0.0; 5.55.7 fixes them

2 more

Release note

Major Changes

  • Breaking

    Minimum supported Node version is now Node 16

  • Breaking

    Minimum supported webpack version is now webpack 5

  • Breaking

    Bundlers must specify the browser condition when building a frontend bundle for the browser

  • Breaking

    Minimum supported vite-plugin-svelte version is now 2.4.1. SvelteKit users can upgrade to 1.20.0 or newer to ensure a compatible version

  • Breaking

    Minimum supported rollup-plugin-svelte version is now 7.1.5

  • Breaking

    Minimum supported svelte-loader is now 3.1.8

  • Breaking

    Minimum supported TypeScript version is now TypeScript 5 (it will likely work with lower versions, but we make no guarantees about that)

  • Breaking

    Remove svelte/register hook, CJS runtime version and CJS compiler output

  • Breaking

    Stricter types for createEventDispatcher (see PR for migration instructions)

  • Breaking

    Stricter types for Action and ActionReturn (see PR for migration instructions)

  • Breaking

    Stricter types for onMount - now throws a type error when returning a function asynchronously to catch potential mistakes around callback functions
    (see PR for migration instructions)

  • Breaking

    Overhaul and drastically improve creating custom elements with Svelte (see PR for list of changes and migration instructions) ([#8457](github.
    com/sveltejs/svelte/pull/8457))

  • Breaking

    Deprecate SvelteComponentTyped in favor of SvelteComponent

  • Breaking

    Make transitions local by default to prevent confusion around page navigations

  • Breaking

    Error on falsy values instead of stores passed to derived

  • Breaking

    Custom store implementers now need to pass an update function additionally to the set function ([#6750](github.com/sveltejs/svelte/pull/
    6750))

  • Breaking

    Do not expose default slot bindings to named slots and vice versa

  • Breaking

    Change order in which preprocessors are applied

  • Breaking

    The runtime now makes use of classList.toggle(name, boolean) which does not work in very old browsers ([#8629](github.com/sveltejs/svelte/
    pull/8629))

  • Breaking

    Apply inert to outroing elements

  • Breaking

    Use CustomEvent constructor instead of deprecated createEvent method

Minor Changes

  • Add a way to modify attributes for script/style preprocessors

  • Improve hydration speed by adding data-svelte-h attribute to detect unchanged HTML elements

  • Add a11y no-noninteractive-element-interactions rule

  • Add a11y-no-static-element-interactionsrule

  • Allow #each to iterate over iterables like Set, Map etc

  • Improve duplicate key error for keyed each blocks

  • Warn about : in attributes and props to prevent ambiguity with Svelte directives

  • Add version info to window. You can opt out by setting discloseVersion to false in the compiler options

  • Smaller minified output for destructor chunks

Patch Changes

  • Bind null option and input values consistently

  • Allow $store to be used with changing values including nullish values

  • Initialize stylesheet with /* empty */ to enable setting CSP directive that also works in Safari

  • Treat slots as if they don't exist when using CSS adjacent and general sibling combinators

  • Fix transitions so that they don't require a style-src 'unsafe-inline' Content Security Policy (CSP) (#6662).

  • Explicitly disallow var declarations extending the reactive statement scope

  • Improve error message when trying to use animate: directives on inline components

  • Export ComponentType from svelte entrypoint

  • Never use html optimization for mustache tags in hydration mode

  • Derived store types

  • Generate type declarations with dts-buddy

  • Ensure types are loaded with all TS settings

  • Account for preprocessor source maps when calculating meta info

  • Warn on boolean compilerOptions.css

  • Export correct SvelteComponent type

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.