· development · 3 min read
Astro 4.0 beta released
The Astro team has released the first beta of Astro 4.0, marking a significant step forward in the development of this popular framework. This beta version introduces several enhancements and bug fixes, including support for Vite 5, new lifecycle events for the <ViewTransitions /> router, and a fallback strategy for prefetching in reduced data scenarios.
![The Astro team has released the first beta of Astro 4.0, marking a significant step forward in the development of this popular framework. This beta version introduces several enhancements and bug fixes, including support for Vite 5, new lifecycle events for the <ViewTransitions /> router, and a fallback strategy for prefetching in reduced data scenarios.](/assets/asset.En8HFoin.png)
Astro 4.0 beta released
The Astro team has released the first beta of Astro 4.0, marking a significant step forward in the development of this popular framework. This beta version introduces several enhancements and bug fixes, including support for Vite 5, new lifecycle events for the <ViewTransitions />
router, and a fallback strategy for prefetching in reduced data scenarios.
What’s new in Astro 4.0
Vite 5 integration: Astro 4.0 aligns with the latest advancements in Vite, the internal build tool that powers the framework. By incorporating Vite 5, Astro 4.0 ensures compatibility with modern web development practices and leverages the latest performance optimizations.
Stable experimental features: Several experimental features that have been under development are now slated for stabilization in Astro 4.0. These features will be marked as stable, providing developers with greater confidence in their adoption.
Additional updates with Astro 3.6
Alongside the Astro 4 beta release, the Astro team has also launched Astro 3.6, bringing forth new events for the <ViewTransitions />
router and a fallback mechanism for prefetching in reduced data environments.
View transition events
Astro 3.6 introduces three new events as part of the <ViewTransitions />
router’s lifecycle:
astro:before-preparation
: Triggered before thepreparation
step, where the content of the new page is loaded.astro:after-preparation
: Triggered after the content has been loaded.astro:before-swap
: Triggered before theswap
step, where the contents of the old page are replaced with those of the new page.
These events provide developers with greater control over the navigation process and enable enhanced user interactions.
Prefetch fallback
In previous versions, prefetching was entirely disabled when users faced slow connections or had data saver preferences enabled. Astro 3.6 implements a prefetch fallback strategy that triggers prefetching on tap
, initiating the loading of the next page when the user initiates a link click but before they release the click. This approach ensures that prefetching occurs only when there’s a high likelihood of the user navigating to the next page.
Additional bug fixes
Astro 3.6 also includes various bug fixes that address known issues and improve overall stability. For a comprehensive overview of the fixes, refer to the release notes.
The Astro team continues to push the boundaries of web development with these advancements, providing developers with a powerful and versatile framework for building exceptional web experiences.
Trying out the Astro 4.0 beta
Eager developers can explore the Astro 4.0 beta by installing the astro@beta
package. This command initialises a new project with Astro 4.0:
npm init astro@beta
While the upgrade guide is still in development, users can refer to the Astro 4.0 upgrade guide pull request and its related issue for detailed information about breaking changes.
Sources