skip to content

What's new in Astro 3.0

/ 2 min read

Astro 3.0 is here. 4.3.2.1. Lets upgrade and learn what's new.

Upgrading to Astro 3

Introduction

It is finally here! Let’s upgrade to Astro 3.0 using pnpm.

For the uninitiated, Astro is a trailblazing static site generator. It allows you to utilize multiple frameworks, such as Vue, React, and Tailwind CSS, all under one roof. The new Astro 3.0 is a marvel, boasting View Transitions API support and a slew of other enhancements that we’ll dive into shortly.

What’s New in Astro 3.0?

Astro 3.0 is essentially a Swiss Army knife for modern web development. Its marquee feature is the support for View Transitions API, enabling you to add animations like fade and slide effortlessly. Moreover, Astro 3.0 ensures 30-75% faster component rendering and brings image optimization to the stable phase. SSR and HMR improvements are just the cherry on top. Read all about Astro 3.0.x on the official website

Upgrading to Astro 3.0 using pnpm

You can effortlessly upgrade to the latest Astro using pnpm, a fast and disk-efficient package manager.

pnpm install astro@latest

Updating All Dependencies

To upgrade all your dependencies in package.json, simply run:

pnpm up --latest	

Why pnpm?

Beyond its speed, pnpm saves disk space by reusing packages, thereby making it an efficient alternative to npm or yarn.

New Image Optimization Techniques

Astro 3.0 takes image optimization to the next level. You can now import images directly and let Astro do the heavy lifting. For instance:

import { Image } from "astro:assets";
import myImage from "../assets/penguin.png";

<Image src={myImage} alt="A dapper penguin!" />

Astro 3.0 has migrated to Sharp, an image optimization library, and it also supports remote image optimization, making life easier for content teams.

Wrapping It Up

The leap to Astro 3.0 is amazing. Packed with new features, and an unforgettably smooth ride getting there. With pnpm in your toolkit, the upgrade was just two commands away, and I was enjoying the wind of performance in my hair and the melody of efficiency in my ears, while riding the build all the way to Cloudflare Pages.

So, there you have it—your non-ultimate guide to upgrading to Astro 3.0 using pnpm, sprinkled with all the new features you can exploit. Happy coding! For a more ultimate guide, take a peek at the official documentation for upgrading to v3.