Upgrade: v0.3.x-beta to v0.4.0-beta
This guide walks you through every change between Velocity v0.3.x-beta and v0.4.0-beta.
Overview
Section titled “Overview”| v0.3.x-beta | v0.4.0-beta | |
|---|---|---|
| Astro | 6.0.0-beta.9 | 6.0.0-beta.11 |
| @astrojs/mdx | beta.5 | beta.7 |
| @astrojs/check | 0.9.6 | 0.9.7-beta.1 |
| OG image renderer | @resvg/resvg-js | sharp |
| Vite workarounds | ssr.external + optimizeDeps.exclude for resvg | Removed |
Migration Steps
Section titled “Migration Steps”-
Update
package.jsondependenciesBump the core Astro packages:
"astro": "6.0.0-beta.9","astro": "6.0.0-beta.11","@astrojs/mdx": "5.0.0-beta.5","@astrojs/mdx": "5.0.0-beta.7","@astrojs/check": "0.9.6","@astrojs/check": "0.9.7-beta.1", -
Swap
@resvg/resvg-jsforsharpRemove the old renderer and add Sharp:
Terminal window pnpm remove @resvg/resvg-jspnpm add sharp -
Update
src/lib/og.tsReplace the Resvg import and rendering call with Sharp:
import { Resvg } from '@resvg/resvg-js';import sharp from 'sharp';Then update the SVG→PNG conversion at the bottom of the file:
const resvg = new Resvg(svg, { fitTo: { mode: 'width', value: 1200 } });return resvg.render().asPng();return Buffer.from(await sharp(Buffer.from(svg)).resize(1200).png().toBuffer()); -
Clean up
astro.config.mjsRemove the Vite workarounds that were only needed for
@resvg/resvg-js:vite: {ssr: {external: ['@resvg/resvg-js'],},optimizeDeps: {exclude: ['@resvg/resvg-js'],},},If the
vitekey is now empty, you can remove it entirely. -
Install and verify
Terminal window pnpm install && pnpm buildCheck that OG images are still generated under
/og/[...slug].pngand that the build completes without errors.
Verify the Upgrade
Section titled “Verify the Upgrade”Run the full verification suite:
pnpm build && pnpm lint && pnpm checkAlso manually verify:
- OG images generate correctly (check a few
/og/*.pngroutes) - No Vite warnings about
@resvg/resvg-jsin the build output - Build time is the same or faster (Sharp is typically quicker than Resvg)
What Changed
Section titled “What Changed”This is a dependency-only release with no breaking API changes. All component APIs, props, and import paths remain identical to v0.3.x-beta.
The key improvement is replacing @resvg/resvg-js — a platform-specific native module that required Vite SSR workarounds — with sharp, which Astro already bundles for image optimization. This simplifies the Vite config and removes a class of build-time issues on platforms like Vercel and Cloudflare.