Svelte 4 shrinks code footprint, compiled output

Svelte 4 shrinks code footprint, compiled output

Upgrade reduces Svelte package size by 75%, produces smaller and faster hydration code, and lays the groundwork for Svelte 5.

Credit: Titima Ongkantong / Shutterstock

More than four years after the arrival of Svelte 3, Svelte 4 is now available, offering smaller and faster code hydration for better performance.

Svelte 4 reduces the Svelte package size by nearly 75%, from 10.6MB to 2.8MB, translating to less waiting on npm install. This will be especially noticeable for users of the Svelte REPL, users with limited connectivity, and users loading the interactive learning experience for the first time, the Svelte team said.

Users of SvelteKit can see the shrinkage in compiled output by examining the .svelte-kit/output/client/_app/immutable/nodes folder.

Other improvements in Svelte 4 include a more consistent and intuitive authoring experience: |local now is the default for transactions to avoid animations blocking page transitions, preprocessors are easier to write, and a number of fixes make CSP (Content Security Policy) easier to use.

Further, the number of dependencies in Svelte has been reduced from 61 to 16, resulting in faster downloads and less susceptibility to supply chain attacks. The number of dependencies in SvelteKit has been reduced slightly, as well.

Described as mainly a maintenance release, Svelte 4 has been updated to take advantage of improvements to Node.js and browser APIs. Svelte 4 sets the stage for the next generation of Svelte to be released as Svelte 5, the Svelte team said. Svelte 5 will be a rewrite of the compiler and runtime, offering performance improvements and major new features.

Svelte lets developers assemble web UIs using HTML, CSS, JavaScript, and the Svelte compiler. Most apps and libraries compatible with Svelte 3 should be compatible with Svelte 4, the Svelte team said.

Svelte can be installed locally via NPM:

npm create svelte@latest

Developers also can try out Svelte 4 on StackBlitz.

Follow Us

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.


EDGE 2024

Register your interest now for EDGE 2024!



How MSPs can capitalise on integrating AI into existing services

How MSPs can capitalise on integrating AI into existing services

​Given the pace of change, scale of digitalisation and evolution of generative AI, partners must get ahead of the trends to capture the best use of innovative AI solutions to develop new service opportunities. For MSPs, integrating AI capabilities into existing service portfolios can unlock enhancements in key areas including managed hosting, cloud computing and data centre management. This exclusive Reseller News roundtable in association with rhipe, a Crayon company and VMware, focused on how partners can integrate generative AI solutions into existing service offerings and unlocking new revenue streams.

How MSPs can capitalise on integrating AI into existing services
Access4 holds inaugural A/NZ Annual Conference

Access4 holds inaugural A/NZ Annual Conference

​Access4 held its inaugural Annual Conference in Port Douglass, Queensland, for Australia and New Zealand from 9-11 October, hosting partners from across the region with presentations on Access4 product updates, its 2023 Partner of the Year awards and more.

Access4 holds inaugural A/NZ Annual Conference
Show Comments